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/index.mjs
CHANGED
|
@@ -765,6 +765,12 @@ var SKIP_REFRESH = [
|
|
|
765
765
|
// regardless of what session state came before it.
|
|
766
766
|
"/api/v1/auth/device",
|
|
767
767
|
"/oauth2/token",
|
|
768
|
+
// CONTRACT.md §14.2 rule 5 (contract 1.62): a client that fails to
|
|
769
|
+
// authenticate at the device endpoints is `401 invalid_client`, which is not
|
|
770
|
+
// an expired session and which refreshing cannot fix. `/oauth2/token` (the
|
|
771
|
+
// poll) was already here; the authorization endpoint now authenticates the
|
|
772
|
+
// client too, so its 401 must not enter the §9 guard either.
|
|
773
|
+
"/oauth2/device_authorization",
|
|
768
774
|
"/oauth2/introspect",
|
|
769
775
|
"/oauth2/revoke"
|
|
770
776
|
];
|
|
@@ -773,6 +779,9 @@ function installCsrfInterceptor(axiosInstance, session) {
|
|
|
773
779
|
if (session.isForeignHost(config.url)) {
|
|
774
780
|
return config;
|
|
775
781
|
}
|
|
782
|
+
if (isOAuth2Endpoint(config.url, session.baseUrl)) {
|
|
783
|
+
return config;
|
|
784
|
+
}
|
|
776
785
|
const method = (config.method ?? "get").toLowerCase();
|
|
777
786
|
const cookieString = typeof document !== "undefined" ? document.cookie : "";
|
|
778
787
|
const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
|
|
@@ -826,15 +835,35 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
826
835
|
}
|
|
827
836
|
);
|
|
828
837
|
}
|
|
838
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
839
|
+
if (!url) {
|
|
840
|
+
return false;
|
|
841
|
+
}
|
|
842
|
+
try {
|
|
843
|
+
const base = new URL(baseUrl);
|
|
844
|
+
let path = new URL(url, base).pathname;
|
|
845
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
846
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
847
|
+
path = path.slice(prefix.length);
|
|
848
|
+
}
|
|
849
|
+
return path.startsWith("/oauth2/");
|
|
850
|
+
} catch {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
829
854
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
830
855
|
axiosInstance.interceptors.request.use((config) => {
|
|
831
856
|
const deviceToken = session.deviceAccessToken;
|
|
832
|
-
|
|
857
|
+
const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
|
|
858
|
+
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
833
859
|
return config;
|
|
834
860
|
}
|
|
835
861
|
const noCred = session.noCredentialsConfig();
|
|
836
862
|
Object.assign(config, noCred);
|
|
837
863
|
config.headers = config.headers ?? {};
|
|
864
|
+
if (oauth2) {
|
|
865
|
+
return config;
|
|
866
|
+
}
|
|
838
867
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
839
868
|
config.headers["Cookie"] = "";
|
|
840
869
|
return config;
|
|
@@ -1796,10 +1825,25 @@ var NotFoundError = class _NotFoundError extends AuthzError {
|
|
|
1796
1825
|
var ConflictError = class _ConflictError extends AuthzError {
|
|
1797
1826
|
/** The registry operation that conflicted. */
|
|
1798
1827
|
operation;
|
|
1799
|
-
|
|
1828
|
+
/**
|
|
1829
|
+
* The body's `reason_code`, as the server spelled it (contract 1.62, §36.4),
|
|
1830
|
+
* or `undefined` when the body carries none (a server that predates it, or a
|
|
1831
|
+
* `409` of an operation that does not name one).
|
|
1832
|
+
*
|
|
1833
|
+
* The `409` of every `network` operation says which conflict it is:
|
|
1834
|
+
* `stale_version`, `strands_profile`, `has_children`, `site_gone`,
|
|
1835
|
+
* `duplicate_name`, `duplicate_vlan`, `duplicate_rank`, `profile_exists` or
|
|
1836
|
+
* `other` (§36.3 rule 2). The vocabulary is **open**: a value this SDK does
|
|
1837
|
+
* not know is surfaced verbatim, and a caller branches on this member —
|
|
1838
|
+
* never on `message`, which an SDK must not parse. It is not the `reason` of
|
|
1839
|
+
* an authorization decision (§3), which is a human string.
|
|
1840
|
+
*/
|
|
1841
|
+
reasonCode;
|
|
1842
|
+
constructor(operation, message, reasonCode) {
|
|
1800
1843
|
super(message);
|
|
1801
1844
|
this.name = "ConflictError";
|
|
1802
1845
|
this.operation = operation;
|
|
1846
|
+
this.reasonCode = reasonCode;
|
|
1803
1847
|
Object.setPrototypeOf(this, _ConflictError.prototype);
|
|
1804
1848
|
}
|
|
1805
1849
|
};
|
|
@@ -2088,6 +2132,14 @@ function omitEmptyTenantScope(body) {
|
|
|
2088
2132
|
}
|
|
2089
2133
|
return body;
|
|
2090
2134
|
}
|
|
2135
|
+
function omitNullMembers(body, members) {
|
|
2136
|
+
if (!body || typeof body !== "object") return body;
|
|
2137
|
+
const record = body;
|
|
2138
|
+
if (!members.some((m) => m in record && record[m] === null)) return body;
|
|
2139
|
+
const copy = { ...record };
|
|
2140
|
+
for (const m of members) if (copy[m] === null) delete copy[m];
|
|
2141
|
+
return copy;
|
|
2142
|
+
}
|
|
2091
2143
|
function roleAssignmentInherits(assignment) {
|
|
2092
2144
|
return assignment.inherit ?? true;
|
|
2093
2145
|
}
|
|
@@ -2564,7 +2616,8 @@ function failure(report) {
|
|
|
2564
2616
|
);
|
|
2565
2617
|
if (!found) return void 0;
|
|
2566
2618
|
const message = found.outcome.status === "rebind-failed" ? `${found.outcome.message}${found.outcome.restoreSucceeded ? " (previous binding restored)" : ` (restore also failed: ${found.outcome.restoreMessage ?? "unknown error"})`}` : found.outcome.message;
|
|
2567
|
-
|
|
2619
|
+
const reasonCode = found.outcome.status === "failed" ? found.outcome.reasonCode : void 0;
|
|
2620
|
+
return reasonCode === void 0 ? { action: found.action, message } : { action: found.action, message, reasonCode };
|
|
2568
2621
|
}
|
|
2569
2622
|
function isComplete(report) {
|
|
2570
2623
|
return failure(report) === void 0;
|
|
@@ -2582,6 +2635,7 @@ function validate(manifest) {
|
|
|
2582
2635
|
const groups = manifest.groups ?? [];
|
|
2583
2636
|
const users = manifest.users ?? [];
|
|
2584
2637
|
const serviceAccounts = manifest.serviceAccounts ?? [];
|
|
2638
|
+
const network = manifest.network;
|
|
2585
2639
|
const resourceKeys = new Set(resources.map((r) => r.key));
|
|
2586
2640
|
const scopeKeys = new Set(resources.flatMap((r) => (r.scopes ?? []).map((s) => s.key)));
|
|
2587
2641
|
const permissionKeys = new Set(permissions.map((p) => p.key));
|
|
@@ -2595,6 +2649,7 @@ function validate(manifest) {
|
|
|
2595
2649
|
duplicates("group", groups.map((g) => g.key), problems);
|
|
2596
2650
|
duplicates("user", users.map((u) => u.key), problems);
|
|
2597
2651
|
duplicates("service account", serviceAccounts.map((s) => s.key), problems);
|
|
2652
|
+
if (network !== void 0) validateNetwork(network, problems);
|
|
2598
2653
|
for (const resource of resources) {
|
|
2599
2654
|
if (resource.parent && !resourceKeys.has(resource.parent)) {
|
|
2600
2655
|
problems.push(
|
|
@@ -2674,6 +2729,51 @@ function validate(manifest) {
|
|
|
2674
2729
|
}
|
|
2675
2730
|
}
|
|
2676
2731
|
var q = (s) => JSON.stringify(s);
|
|
2732
|
+
function validateNetwork(network, problems) {
|
|
2733
|
+
if (Array.isArray(network.policy)) {
|
|
2734
|
+
problems.push("network declares more than one policy; the tenant has exactly one");
|
|
2735
|
+
}
|
|
2736
|
+
const segments = network.segments ?? [];
|
|
2737
|
+
const profiles = network.profiles ?? [];
|
|
2738
|
+
duplicates("network segment", segments.map((s) => s.key), problems);
|
|
2739
|
+
const naturalKeys = /* @__PURE__ */ new Set();
|
|
2740
|
+
for (const segment of segments) {
|
|
2741
|
+
const natural = `${segment.site}/${segment.kind}/${segment.name}`;
|
|
2742
|
+
if (naturalKeys.has(natural)) {
|
|
2743
|
+
problems.push(
|
|
2744
|
+
`network segment ${q(natural)} (site, kind, name) is declared more than once`
|
|
2745
|
+
);
|
|
2746
|
+
}
|
|
2747
|
+
naturalKeys.add(natural);
|
|
2748
|
+
const seenFilters = /* @__PURE__ */ new Set();
|
|
2749
|
+
for (const filter of segment.filterIds ?? []) {
|
|
2750
|
+
if (seenFilters.has(filter)) {
|
|
2751
|
+
problems.push(
|
|
2752
|
+
`network segment ${q(segment.key)} lists Filter-Id ${q(filter)} more than once in filterIds`
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2755
|
+
seenFilters.add(filter);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
const segmentKeys = new Set(segments.map((s) => s.key));
|
|
2759
|
+
const profiled = /* @__PURE__ */ new Set();
|
|
2760
|
+
for (const profile of profiles) {
|
|
2761
|
+
if (!segmentKeys.has(profile.segment)) {
|
|
2762
|
+
problems.push(
|
|
2763
|
+
`network profile names segment ${q(profile.segment)}, which no network segment declares`
|
|
2764
|
+
);
|
|
2765
|
+
}
|
|
2766
|
+
if (profiled.has(profile.segment)) {
|
|
2767
|
+
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
2768
|
+
}
|
|
2769
|
+
profiled.add(profile.segment);
|
|
2770
|
+
if (profile.terminationAction === null) {
|
|
2771
|
+
problems.push(
|
|
2772
|
+
`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)`
|
|
2773
|
+
);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2677
2777
|
function duplicates(kind, keys, problems) {
|
|
2678
2778
|
const seen = /* @__PURE__ */ new Set();
|
|
2679
2779
|
for (const key of keys) {
|
|
@@ -2719,7 +2819,9 @@ var emptyResolved = () => ({
|
|
|
2719
2819
|
roles: /* @__PURE__ */ new Map(),
|
|
2720
2820
|
groups: /* @__PURE__ */ new Map(),
|
|
2721
2821
|
users: /* @__PURE__ */ new Map(),
|
|
2722
|
-
serviceAccounts: /* @__PURE__ */ new Map()
|
|
2822
|
+
serviceAccounts: /* @__PURE__ */ new Map(),
|
|
2823
|
+
segments: /* @__PURE__ */ new Map(),
|
|
2824
|
+
segmentVersions: /* @__PURE__ */ new Map()
|
|
2723
2825
|
});
|
|
2724
2826
|
var ManifestApi = class {
|
|
2725
2827
|
#client;
|
|
@@ -2752,6 +2854,23 @@ var ManifestApi = class {
|
|
|
2752
2854
|
async #read(manifest) {
|
|
2753
2855
|
const c = this.#client;
|
|
2754
2856
|
const start = { limit: PLAN_PAGE };
|
|
2857
|
+
if (manifest.network !== void 0 && !hasShapeSections(manifest)) {
|
|
2858
|
+
return {
|
|
2859
|
+
resources: [],
|
|
2860
|
+
scopes: /* @__PURE__ */ new Map(),
|
|
2861
|
+
permissions: [],
|
|
2862
|
+
roles: [],
|
|
2863
|
+
groups: [],
|
|
2864
|
+
users: [],
|
|
2865
|
+
serviceAccounts: [],
|
|
2866
|
+
roleGrants: /* @__PURE__ */ new Map(),
|
|
2867
|
+
roleUserBindings: /* @__PURE__ */ new Map(),
|
|
2868
|
+
roleGroupBindings: /* @__PURE__ */ new Map(),
|
|
2869
|
+
roleServiceAccountBindings: /* @__PURE__ */ new Map(),
|
|
2870
|
+
groupMembers: /* @__PURE__ */ new Map(),
|
|
2871
|
+
network: await this.#readNetwork(manifest.network, start)
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2755
2874
|
const resources = await c.resources.listAll(start);
|
|
2756
2875
|
const permissions = await c.permissions.listAll(start);
|
|
2757
2876
|
const roles = await c.roles.listAll(start);
|
|
@@ -2807,9 +2926,29 @@ var ManifestApi = class {
|
|
|
2807
2926
|
roleUserBindings,
|
|
2808
2927
|
roleGroupBindings,
|
|
2809
2928
|
roleServiceAccountBindings,
|
|
2810
|
-
groupMembers
|
|
2929
|
+
groupMembers,
|
|
2930
|
+
network: manifest.network ? await this.#readNetwork(manifest.network, start) : void 0
|
|
2811
2931
|
};
|
|
2812
2932
|
}
|
|
2933
|
+
/**
|
|
2934
|
+
* §27.6.2 item 3: `get_policy`, `list_segments` and `list_profiles`, each
|
|
2935
|
+
* list walked to exhaustion, and nothing else — `plan` issues `GET`s only.
|
|
2936
|
+
* A section that states no policy does not read it; one that states no
|
|
2937
|
+
* profile does not list them.
|
|
2938
|
+
*/
|
|
2939
|
+
async #readNetwork(spec, start) {
|
|
2940
|
+
const c = this.#client;
|
|
2941
|
+
const policy = spec.policy ? await c.network.getPolicy() : void 0;
|
|
2942
|
+
const wantSegments = (spec.segments ?? []).length > 0 || (spec.profiles ?? []).length > 0;
|
|
2943
|
+
const segments = wantSegments ? await c.network.listSegmentsAll(void 0, start) : [];
|
|
2944
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
2945
|
+
if ((spec.profiles ?? []).length) {
|
|
2946
|
+
for (const profile of await c.network.listProfilesAll(start)) {
|
|
2947
|
+
profiles.set(profile.segment_id, profile);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
return { policy, segments, profiles };
|
|
2951
|
+
}
|
|
2813
2952
|
// -------------------------------------------------------------------
|
|
2814
2953
|
// Plan
|
|
2815
2954
|
// -------------------------------------------------------------------
|
|
@@ -3080,8 +3219,97 @@ var ManifestApi = class {
|
|
|
3080
3219
|
push
|
|
3081
3220
|
);
|
|
3082
3221
|
}
|
|
3222
|
+
if (manifest.network && snapshot.network) {
|
|
3223
|
+
this.#networkSteps(manifest.network, snapshot.network, resolved, push);
|
|
3224
|
+
}
|
|
3083
3225
|
return out;
|
|
3084
3226
|
}
|
|
3227
|
+
/**
|
|
3228
|
+
* §27.6.2 — the `network` section: the policy, then the segments, then the
|
|
3229
|
+
* profiles, a profile after its segment (item 2). Every comparison is with
|
|
3230
|
+
* the value **as the read returns it** (item 3): a profile's effective
|
|
3231
|
+
* (clamped) `session_timeout_secs`, a segment's `filter_ids` as a set.
|
|
3232
|
+
* Silence is not an assertion (rule 3): a member left off never drifts, and
|
|
3233
|
+
* the `Update` body carries the read's value for it (item 4).
|
|
3234
|
+
*/
|
|
3235
|
+
#networkSteps(spec, read, resolved, push) {
|
|
3236
|
+
if (spec.policy) {
|
|
3237
|
+
const current = read.policy;
|
|
3238
|
+
const drifted = current.session_timeout_max_secs !== spec.policy.sessionTimeoutMaxSecs;
|
|
3239
|
+
push(
|
|
3240
|
+
drifted ? "update" : "no-change",
|
|
3241
|
+
"network-policy",
|
|
3242
|
+
"network.policy",
|
|
3243
|
+
"network policy (Session-Timeout cap)",
|
|
3244
|
+
drifted ? {
|
|
3245
|
+
kind: "update-network-policy",
|
|
3246
|
+
body: {
|
|
3247
|
+
session_timeout_max_secs: spec.policy.sessionTimeoutMaxSecs,
|
|
3248
|
+
version: current.version
|
|
3249
|
+
}
|
|
3250
|
+
} : { kind: "noop" }
|
|
3251
|
+
);
|
|
3252
|
+
}
|
|
3253
|
+
const segments = spec.segments ?? [];
|
|
3254
|
+
for (const segment of segments) {
|
|
3255
|
+
const found = read.segments.find(
|
|
3256
|
+
(r) => r.site_key === segment.site && r.kind === segment.kind && r.name === segment.name
|
|
3257
|
+
);
|
|
3258
|
+
const summary = `network segment ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3259
|
+
if (!found) {
|
|
3260
|
+
push("create", "network-segment", segment.key, summary, {
|
|
3261
|
+
kind: "create-network-segment",
|
|
3262
|
+
key: segment.key,
|
|
3263
|
+
body: segmentCreateBody(segment)
|
|
3264
|
+
});
|
|
3265
|
+
continue;
|
|
3266
|
+
}
|
|
3267
|
+
resolved.segments.set(segment.key, found.id);
|
|
3268
|
+
resolved.segmentVersions.set(segment.key, found.version);
|
|
3269
|
+
const drifted = segmentDrifted(segment, found);
|
|
3270
|
+
push(
|
|
3271
|
+
drifted ? "update" : "no-change",
|
|
3272
|
+
"network-segment",
|
|
3273
|
+
segment.key,
|
|
3274
|
+
summary,
|
|
3275
|
+
drifted ? {
|
|
3276
|
+
kind: "update-network-segment",
|
|
3277
|
+
key: segment.key,
|
|
3278
|
+
id: found.id,
|
|
3279
|
+
body: segmentReplaceBody(segment, found)
|
|
3280
|
+
} : { kind: "noop" }
|
|
3281
|
+
);
|
|
3282
|
+
}
|
|
3283
|
+
const bySegment = new Map((spec.profiles ?? []).map((p) => [p.segment, p]));
|
|
3284
|
+
for (const segment of segments) {
|
|
3285
|
+
const profile = bySegment.get(segment.key);
|
|
3286
|
+
if (!profile) continue;
|
|
3287
|
+
const segmentId = resolved.segments.get(segment.key);
|
|
3288
|
+
const found = segmentId ? read.profiles.get(segmentId) : void 0;
|
|
3289
|
+
const summary = `network profile of ${JSON.stringify(`${segment.site}/${segment.kind}/${segment.name}`)}`;
|
|
3290
|
+
if (!found) {
|
|
3291
|
+
push("create", "network-profile", segment.key, summary, {
|
|
3292
|
+
kind: "create-network-profile",
|
|
3293
|
+
segment: segment.key,
|
|
3294
|
+
profile: profileCreateInput(profile)
|
|
3295
|
+
});
|
|
3296
|
+
continue;
|
|
3297
|
+
}
|
|
3298
|
+
const drifted = profileDrifted(profile, found);
|
|
3299
|
+
push(
|
|
3300
|
+
drifted ? "update" : "no-change",
|
|
3301
|
+
"network-profile",
|
|
3302
|
+
segment.key,
|
|
3303
|
+
summary,
|
|
3304
|
+
drifted ? {
|
|
3305
|
+
kind: "update-network-profile",
|
|
3306
|
+
segment: segment.key,
|
|
3307
|
+
version: found.version,
|
|
3308
|
+
profile: profileReplaceInput(profile, found)
|
|
3309
|
+
} : { kind: "noop" }
|
|
3310
|
+
);
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3085
3313
|
/**
|
|
3086
3314
|
* §27.6.1 item 2 — one subject's `roles[]` against the server's existing
|
|
3087
3315
|
* bindings for it. Shared by groups, users and service accounts: the
|
|
@@ -3149,9 +3377,14 @@ var ManifestApi = class {
|
|
|
3149
3377
|
}
|
|
3150
3378
|
} catch (err) {
|
|
3151
3379
|
stopped = true;
|
|
3380
|
+
const reasonCode = err instanceof ConflictError ? err.reasonCode : void 0;
|
|
3152
3381
|
out.push({
|
|
3153
3382
|
action,
|
|
3154
|
-
outcome: {
|
|
3383
|
+
outcome: {
|
|
3384
|
+
status: "failed",
|
|
3385
|
+
message: err instanceof Error ? err.message : String(err),
|
|
3386
|
+
...reasonCode === void 0 ? {} : { reasonCode }
|
|
3387
|
+
}
|
|
3155
3388
|
});
|
|
3156
3389
|
}
|
|
3157
3390
|
}
|
|
@@ -3258,6 +3491,34 @@ var ManifestApi = class {
|
|
|
3258
3491
|
description: step.description
|
|
3259
3492
|
});
|
|
3260
3493
|
return void 0;
|
|
3494
|
+
case "update-network-policy":
|
|
3495
|
+
await c.network.replacePolicy(step.body);
|
|
3496
|
+
return void 0;
|
|
3497
|
+
case "create-network-segment": {
|
|
3498
|
+
const created = await c.network.createSegment(step.body);
|
|
3499
|
+
resolved.segments.set(step.key, created.id);
|
|
3500
|
+
resolved.segmentVersions.set(step.key, created.version);
|
|
3501
|
+
return void 0;
|
|
3502
|
+
}
|
|
3503
|
+
case "update-network-segment": {
|
|
3504
|
+
const replaced = await c.network.replaceSegment(step.id, step.body);
|
|
3505
|
+
resolved.segmentVersions.set(step.key, replaced.version);
|
|
3506
|
+
return void 0;
|
|
3507
|
+
}
|
|
3508
|
+
case "create-network-profile":
|
|
3509
|
+
await c.network.createProfile({
|
|
3510
|
+
segment_id: lookup(resolved.segments, step.segment, "network segment"),
|
|
3511
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3512
|
+
profile: step.profile
|
|
3513
|
+
});
|
|
3514
|
+
return void 0;
|
|
3515
|
+
case "update-network-profile":
|
|
3516
|
+
await c.network.replaceProfile(lookup(resolved.segments, step.segment, "network segment"), {
|
|
3517
|
+
version: step.version,
|
|
3518
|
+
segment_version: lookupVersion(resolved.segmentVersions, step.segment),
|
|
3519
|
+
profile: step.profile
|
|
3520
|
+
});
|
|
3521
|
+
return void 0;
|
|
3261
3522
|
case "assign-role":
|
|
3262
3523
|
await this.#assign(step, resolved);
|
|
3263
3524
|
return void 0;
|
|
@@ -3395,6 +3656,107 @@ function lookup(map, key, kind) {
|
|
|
3395
3656
|
}
|
|
3396
3657
|
return id;
|
|
3397
3658
|
}
|
|
3659
|
+
function hasShapeSections(manifest) {
|
|
3660
|
+
return [
|
|
3661
|
+
manifest.resources,
|
|
3662
|
+
manifest.permissions,
|
|
3663
|
+
manifest.roles,
|
|
3664
|
+
manifest.groups,
|
|
3665
|
+
manifest.users,
|
|
3666
|
+
manifest.serviceAccounts
|
|
3667
|
+
].some((section) => (section ?? []).length > 0);
|
|
3668
|
+
}
|
|
3669
|
+
function lookupVersion(map, key) {
|
|
3670
|
+
const version = map.get(key);
|
|
3671
|
+
if (version === void 0) {
|
|
3672
|
+
throw new NetworkError(
|
|
3673
|
+
`internal: network segment key ${JSON.stringify(key)} has no version; its segment write did not run`
|
|
3674
|
+
);
|
|
3675
|
+
}
|
|
3676
|
+
return version;
|
|
3677
|
+
}
|
|
3678
|
+
function sameSet(a, b) {
|
|
3679
|
+
if (a.length !== b.length) return false;
|
|
3680
|
+
const left = new Set(a);
|
|
3681
|
+
return left.size === new Set(b).size && b.every((name2) => left.has(name2));
|
|
3682
|
+
}
|
|
3683
|
+
function sameOptional(stated, read) {
|
|
3684
|
+
return (stated ?? null) === (read ?? null);
|
|
3685
|
+
}
|
|
3686
|
+
function segmentCreateBody(spec) {
|
|
3687
|
+
const body = {
|
|
3688
|
+
kind: spec.kind,
|
|
3689
|
+
site_key: spec.site,
|
|
3690
|
+
name: spec.name,
|
|
3691
|
+
vlan_id: spec.vlanId
|
|
3692
|
+
};
|
|
3693
|
+
if (spec.filterIds !== void 0) body.filter_ids = [...spec.filterIds];
|
|
3694
|
+
if (spec.rank !== void 0 && spec.rank !== null) body.rank = spec.rank;
|
|
3695
|
+
if (spec.enabled !== void 0) body.enabled = spec.enabled;
|
|
3696
|
+
return body;
|
|
3697
|
+
}
|
|
3698
|
+
function segmentDrifted(spec, read) {
|
|
3699
|
+
if (spec.vlanId !== read.vlan_id) return true;
|
|
3700
|
+
if (spec.rank !== void 0 && !sameOptional(spec.rank, read.rank)) return true;
|
|
3701
|
+
if (spec.enabled !== void 0 && spec.enabled !== read.enabled) return true;
|
|
3702
|
+
if (spec.filterIds !== void 0 && !sameSet(spec.filterIds, read.filter_ids)) return true;
|
|
3703
|
+
return false;
|
|
3704
|
+
}
|
|
3705
|
+
function segmentReplaceBody(spec, read) {
|
|
3706
|
+
const body = {
|
|
3707
|
+
version: read.version,
|
|
3708
|
+
vlan_id: spec.vlanId,
|
|
3709
|
+
filter_ids: [...spec.filterIds ?? read.filter_ids],
|
|
3710
|
+
enabled: spec.enabled ?? read.enabled
|
|
3711
|
+
};
|
|
3712
|
+
const rank = spec.rank === void 0 ? read.rank : spec.rank;
|
|
3713
|
+
if (rank !== void 0 && rank !== null) body.rank = rank;
|
|
3714
|
+
return body;
|
|
3715
|
+
}
|
|
3716
|
+
function profileCreateInput(spec) {
|
|
3717
|
+
const profile = { session_timeout_secs: spec.sessionTimeoutSecs };
|
|
3718
|
+
if (spec.terminationAction != null) profile.termination_action = spec.terminationAction;
|
|
3719
|
+
if (spec.idleTimeoutSecs != null) profile.idle_timeout_secs = spec.idleTimeoutSecs;
|
|
3720
|
+
if (spec.filterId != null) profile.filter_id = spec.filterId;
|
|
3721
|
+
if (spec.serviceType != null) profile.service_type = spec.serviceType;
|
|
3722
|
+
return profile;
|
|
3723
|
+
}
|
|
3724
|
+
function profileDrifted(spec, read) {
|
|
3725
|
+
if (spec.sessionTimeoutSecs !== read.session_timeout_secs) return true;
|
|
3726
|
+
if (spec.terminationAction !== void 0 && spec.terminationAction !== null && spec.terminationAction !== read.termination_action) return true;
|
|
3727
|
+
if (spec.idleTimeoutSecs !== void 0 && !sameOptional(spec.idleTimeoutSecs, read.idle_timeout_secs)) return true;
|
|
3728
|
+
if (spec.filterId !== void 0 && !sameOptional(spec.filterId, read.filter_id)) return true;
|
|
3729
|
+
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
3730
|
+
return false;
|
|
3731
|
+
}
|
|
3732
|
+
var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
|
|
3733
|
+
var KNOWN_SERVICE_TYPES = ["framed_user"];
|
|
3734
|
+
function refuseUnknownCarried(member, stated, read, known) {
|
|
3735
|
+
if (stated !== void 0 || read == null || known.includes(read)) return;
|
|
3736
|
+
throw new ValidationError(
|
|
3737
|
+
"manifest.plan",
|
|
3738
|
+
400,
|
|
3739
|
+
`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)`,
|
|
3740
|
+
[{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
|
|
3741
|
+
);
|
|
3742
|
+
}
|
|
3743
|
+
function profileReplaceInput(spec, read) {
|
|
3744
|
+
const profile = {
|
|
3745
|
+
dictionary: read.dictionary,
|
|
3746
|
+
session_timeout_secs: spec.sessionTimeoutSecs
|
|
3747
|
+
};
|
|
3748
|
+
refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
|
|
3749
|
+
refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
|
|
3750
|
+
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
3751
|
+
if (termination != null) profile.termination_action = termination;
|
|
3752
|
+
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
3753
|
+
if (idle != null) profile.idle_timeout_secs = idle;
|
|
3754
|
+
const filter = spec.filterId === void 0 ? read.filter_id : spec.filterId;
|
|
3755
|
+
if (filter != null) profile.filter_id = filter;
|
|
3756
|
+
const serviceType = spec.serviceType === void 0 ? read.service_type : spec.serviceType;
|
|
3757
|
+
if (serviceType != null) profile.service_type = serviceType;
|
|
3758
|
+
return profile;
|
|
3759
|
+
}
|
|
3398
3760
|
function bindingOf(assignment) {
|
|
3399
3761
|
return {
|
|
3400
3762
|
resourceId: assignment.resource_id ?? void 0,
|
|
@@ -3515,7 +3877,12 @@ function mapManagementError(operation, err) {
|
|
|
3515
3877
|
);
|
|
3516
3878
|
}
|
|
3517
3879
|
if (status === 409) {
|
|
3518
|
-
|
|
3880
|
+
const code = body?.reason_code;
|
|
3881
|
+
return new ConflictError(
|
|
3882
|
+
operation,
|
|
3883
|
+
`${operation}: conflict${detail}`,
|
|
3884
|
+
typeof code === "string" ? code : void 0
|
|
3885
|
+
);
|
|
3519
3886
|
}
|
|
3520
3887
|
if (status === 400 || status === 422) {
|
|
3521
3888
|
return new ValidationError(
|
|
@@ -3525,7 +3892,7 @@ function mapManagementError(operation, err) {
|
|
|
3525
3892
|
parseFieldErrors(body)
|
|
3526
3893
|
);
|
|
3527
3894
|
}
|
|
3528
|
-
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err });
|
|
3895
|
+
return mapHttpStatusToError(status, `${operation}${detail}`, { cause: err, body });
|
|
3529
3896
|
}
|
|
3530
3897
|
function describe(body) {
|
|
3531
3898
|
if (typeof body === "string" && body) return `: ${body}`;
|
|
@@ -4819,7 +5186,7 @@ var CertificatesApi = class {
|
|
|
4819
5186
|
method: "POST",
|
|
4820
5187
|
pathTemplate: "/api/v1/certificates",
|
|
4821
5188
|
path: "/api/v1/certificates",
|
|
4822
|
-
body
|
|
5189
|
+
body: omitNullMembers(body, ["user_id"])
|
|
4823
5190
|
});
|
|
4824
5191
|
return generatedCertificateFromWire(wire);
|
|
4825
5192
|
}
|
|
@@ -4836,7 +5203,7 @@ var CertificatesApi = class {
|
|
|
4836
5203
|
method: "POST",
|
|
4837
5204
|
pathTemplate: "/api/v1/certificates/sign-csr",
|
|
4838
5205
|
path: "/api/v1/certificates/sign-csr",
|
|
4839
|
-
body
|
|
5206
|
+
body: omitNullMembers(body, ["user_id"])
|
|
4840
5207
|
});
|
|
4841
5208
|
return wire;
|
|
4842
5209
|
}
|
|
@@ -5973,12 +6340,29 @@ function ssfStreamInputFrom(stream) {
|
|
|
5973
6340
|
endpoint_url: stream.endpoint_url ?? null,
|
|
5974
6341
|
events_allowed: [...stream.events_allowed],
|
|
5975
6342
|
events_requested: [...stream.events_requested],
|
|
6343
|
+
expected_updated_at: stream.updated_at,
|
|
5976
6344
|
receiver_client_id: stream.receiver_client_id,
|
|
5977
6345
|
status: stream.status,
|
|
5978
6346
|
status_reason: stream.status_reason ?? null,
|
|
5979
6347
|
subject_format: stream.subject_format
|
|
5980
6348
|
};
|
|
5981
6349
|
}
|
|
6350
|
+
function ssfStreamInputWith(stream, changes2 = {}) {
|
|
6351
|
+
const body = ssfStreamInputFrom(stream);
|
|
6352
|
+
const named = Object.entries(changes2).filter(([, v]) => v !== void 0);
|
|
6353
|
+
const record = body;
|
|
6354
|
+
for (const [key, value] of named) record[key] = value;
|
|
6355
|
+
const names = new Set(named.map(([key]) => key));
|
|
6356
|
+
if (names.has("events_allowed") && !names.has("events_requested")) {
|
|
6357
|
+
const ceiling = new Set(body.events_allowed);
|
|
6358
|
+
body.events_requested = stream.events_requested.filter(
|
|
6359
|
+
(e) => ceiling.has(e)
|
|
6360
|
+
);
|
|
6361
|
+
}
|
|
6362
|
+
if (body.events_requested === null) delete body.events_requested;
|
|
6363
|
+
if (body.expected_updated_at === null) delete body.expected_updated_at;
|
|
6364
|
+
return body;
|
|
6365
|
+
}
|
|
5982
6366
|
function scimTargetInputFrom(target) {
|
|
5983
6367
|
return {
|
|
5984
6368
|
auth: { ...target.auth },
|
|
@@ -6302,7 +6686,7 @@ var SsfApi = class _SsfApi {
|
|
|
6302
6686
|
method: "POST",
|
|
6303
6687
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams",
|
|
6304
6688
|
path: `/api/v1/tenants/${tenantId}/ssf/streams`,
|
|
6305
|
-
body: ssfStreamInputToWire(body)
|
|
6689
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6306
6690
|
});
|
|
6307
6691
|
return scrubSsfStream(wire);
|
|
6308
6692
|
}
|
|
@@ -6325,8 +6709,19 @@ var SsfApi = class _SsfApi {
|
|
|
6325
6709
|
* update moves `endpoint_url` to another scheme, host or port while a header
|
|
6326
6710
|
* is stored: then it must carry `authorization_header` again or
|
|
6327
6711
|
* `clear_authorization_header: true`, else `400` (§32.3 rule 5). Start from
|
|
6328
|
-
* `
|
|
6329
|
-
*
|
|
6712
|
+
* `ssfStreamInputWith(await ssf.getStream(id), changes)`, which sends the
|
|
6713
|
+
* `events_requested` and `expected_updated_at` it read and cuts
|
|
6714
|
+
* `events_requested` to a lowered `events_allowed` (or from the plain
|
|
6715
|
+
* converter `ssfStreamInputFrom`, where the cut is yours). An update
|
|
6716
|
+
* overtaken by the receiver's own write is `409`: read the stream again.
|
|
6717
|
+
* **`events_requested` has three meanings on an update** (§32.2, contract
|
|
6718
|
+
* 1.62): **absent resets** the stream to every event of `events_allowed` —
|
|
6719
|
+
* widening what the receiver narrowed; **`[]` is stored as the receiver's
|
|
6720
|
+
* "none"** and the stream carries nothing; **a list is stored as given** and
|
|
6721
|
+
* refused (`400`) if any entry is outside `events_allowed`. A raw API client
|
|
6722
|
+
* is bound by the same meaning: an `events_requested` left out of the `PUT`
|
|
6723
|
+
* resets the stream. `expected_updated_at` is the `updated_at` you read, as
|
|
6724
|
+
* the server's own string; an assigned `null` is "none" and is not sent.
|
|
6330
6725
|
*
|
|
6331
6726
|
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6332
6727
|
* members must be set, but what you do not carry over from a prior read is
|
|
@@ -6344,7 +6739,7 @@ var SsfApi = class _SsfApi {
|
|
|
6344
6739
|
method: "PUT",
|
|
6345
6740
|
pathTemplate: "/api/v1/tenants/{tenant_id}/ssf/streams/{stream_id}",
|
|
6346
6741
|
path: `/api/v1/tenants/${tenantId}/ssf/streams/${encodeURIComponent(streamId)}`,
|
|
6347
|
-
body: ssfStreamInputToWire(body)
|
|
6742
|
+
body: omitNullMembers(ssfStreamInputToWire(body), ["expected_updated_at"])
|
|
6348
6743
|
});
|
|
6349
6744
|
return scrubSsfStream(wire);
|
|
6350
6745
|
}
|
|
@@ -6412,7 +6807,7 @@ var ScimTargetsApi = class {
|
|
|
6412
6807
|
method: "POST",
|
|
6413
6808
|
pathTemplate: "/api/v1/scim-targets",
|
|
6414
6809
|
path: "/api/v1/scim-targets",
|
|
6415
|
-
body: scimTargetInputToWire(body)
|
|
6810
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6416
6811
|
});
|
|
6417
6812
|
return scrubScimTargetResponse(wire);
|
|
6418
6813
|
}
|
|
@@ -6459,7 +6854,7 @@ var ScimTargetsApi = class {
|
|
|
6459
6854
|
method: "PUT",
|
|
6460
6855
|
pathTemplate: "/api/v1/scim-targets/{id}",
|
|
6461
6856
|
path: `/api/v1/scim-targets/${encodeURIComponent(id)}`,
|
|
6462
|
-
body: scimTargetInputToWire(body)
|
|
6857
|
+
body: omitNullMembers(scimTargetInputToWire(body), ["expected_updated_at"])
|
|
6463
6858
|
});
|
|
6464
6859
|
return scrubScimTargetResponse(wire);
|
|
6465
6860
|
}
|
|
@@ -6503,6 +6898,215 @@ var ScimTargetsApi = class {
|
|
|
6503
6898
|
}
|
|
6504
6899
|
};
|
|
6505
6900
|
|
|
6901
|
+
// src/management/ops/network.ts
|
|
6902
|
+
var NetworkApi = class {
|
|
6903
|
+
#client;
|
|
6904
|
+
#scope;
|
|
6905
|
+
/** @internal — reached through `client.<namespace>`, never constructed directly. */
|
|
6906
|
+
constructor(client, scope = {}) {
|
|
6907
|
+
this.#client = client;
|
|
6908
|
+
this.#scope = scope;
|
|
6909
|
+
}
|
|
6910
|
+
/** `GET /api/v1/network/segments` */
|
|
6911
|
+
async listSegments(site, page = {}) {
|
|
6912
|
+
const wire = await sendManagement(this.#client, {
|
|
6913
|
+
operation: "network.list_segments",
|
|
6914
|
+
method: "GET",
|
|
6915
|
+
pathTemplate: "/api/v1/network/segments",
|
|
6916
|
+
path: "/api/v1/network/segments",
|
|
6917
|
+
query: { ...pageQuery(page), "site": site }
|
|
6918
|
+
});
|
|
6919
|
+
return wire;
|
|
6920
|
+
}
|
|
6921
|
+
/**
|
|
6922
|
+
* Walk `network.list_segments` to exhaustion, concatenating every page.
|
|
6923
|
+
*
|
|
6924
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
6925
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
6926
|
+
* rather than an unbounded loop.
|
|
6927
|
+
*/
|
|
6928
|
+
listSegmentsAll(site, start = {}) {
|
|
6929
|
+
return collectPages(start, (p) => this.listSegments(site, p));
|
|
6930
|
+
}
|
|
6931
|
+
/**
|
|
6932
|
+
* `POST /api/v1/network/segments`
|
|
6933
|
+
*
|
|
6934
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6935
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6936
|
+
*/
|
|
6937
|
+
async createSegment(body) {
|
|
6938
|
+
const wire = await sendManagement(this.#client, {
|
|
6939
|
+
operation: "network.create_segment",
|
|
6940
|
+
method: "POST",
|
|
6941
|
+
pathTemplate: "/api/v1/network/segments",
|
|
6942
|
+
path: "/api/v1/network/segments",
|
|
6943
|
+
body
|
|
6944
|
+
});
|
|
6945
|
+
return wire;
|
|
6946
|
+
}
|
|
6947
|
+
/** `GET /api/v1/network/segments/{id}` */
|
|
6948
|
+
async getSegment(id) {
|
|
6949
|
+
const wire = await sendManagement(this.#client, {
|
|
6950
|
+
operation: "network.get_segment",
|
|
6951
|
+
method: "GET",
|
|
6952
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6953
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`
|
|
6954
|
+
});
|
|
6955
|
+
return wire;
|
|
6956
|
+
}
|
|
6957
|
+
/**
|
|
6958
|
+
* `PUT /api/v1/network/segments/{id}`
|
|
6959
|
+
*
|
|
6960
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Only the required
|
|
6961
|
+
* members must be set, but what you do not carry over from a prior read is
|
|
6962
|
+
* not preserved: an optional member left out is overwritten with its
|
|
6963
|
+
* default, not kept (except where noted above). Read first, change the field
|
|
6964
|
+
* you mean, send the whole thing back.
|
|
6965
|
+
*
|
|
6966
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6967
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6968
|
+
*/
|
|
6969
|
+
async replaceSegment(id, body) {
|
|
6970
|
+
const wire = await sendManagement(this.#client, {
|
|
6971
|
+
operation: "network.replace_segment",
|
|
6972
|
+
method: "PUT",
|
|
6973
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6974
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
6975
|
+
body
|
|
6976
|
+
});
|
|
6977
|
+
return wire;
|
|
6978
|
+
}
|
|
6979
|
+
/**
|
|
6980
|
+
* `DELETE /api/v1/network/segments/{id}`
|
|
6981
|
+
*
|
|
6982
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
6983
|
+
* issued exactly once, including the ones that look idempotent.
|
|
6984
|
+
*/
|
|
6985
|
+
async deleteSegment(id, version) {
|
|
6986
|
+
await sendManagement(this.#client, {
|
|
6987
|
+
operation: "network.delete_segment",
|
|
6988
|
+
method: "DELETE",
|
|
6989
|
+
pathTemplate: "/api/v1/network/segments/{id}",
|
|
6990
|
+
path: `/api/v1/network/segments/${encodeURIComponent(id)}`,
|
|
6991
|
+
query: { "version": String(version) }
|
|
6992
|
+
});
|
|
6993
|
+
}
|
|
6994
|
+
/** `GET /api/v1/network/profiles` */
|
|
6995
|
+
async listProfiles(page = {}) {
|
|
6996
|
+
const wire = await sendManagement(this.#client, {
|
|
6997
|
+
operation: "network.list_profiles",
|
|
6998
|
+
method: "GET",
|
|
6999
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7000
|
+
path: "/api/v1/network/profiles",
|
|
7001
|
+
query: { ...pageQuery(page) }
|
|
7002
|
+
});
|
|
7003
|
+
return wire;
|
|
7004
|
+
}
|
|
7005
|
+
/**
|
|
7006
|
+
* Walk `network.list_profiles` to exhaustion, concatenating every page.
|
|
7007
|
+
*
|
|
7008
|
+
* The auto-paging form §27.4 rule 4 requires. It stops on an empty page even
|
|
7009
|
+
* if `total` disagrees, so a misreporting server costs one wasted request
|
|
7010
|
+
* rather than an unbounded loop.
|
|
7011
|
+
*/
|
|
7012
|
+
listProfilesAll(start = {}) {
|
|
7013
|
+
return collectPages(start, (p) => this.listProfiles(p));
|
|
7014
|
+
}
|
|
7015
|
+
/**
|
|
7016
|
+
* `POST /api/v1/network/profiles`
|
|
7017
|
+
*
|
|
7018
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7019
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7020
|
+
*/
|
|
7021
|
+
async createProfile(body) {
|
|
7022
|
+
const wire = await sendManagement(this.#client, {
|
|
7023
|
+
operation: "network.create_profile",
|
|
7024
|
+
method: "POST",
|
|
7025
|
+
pathTemplate: "/api/v1/network/profiles",
|
|
7026
|
+
path: "/api/v1/network/profiles",
|
|
7027
|
+
body
|
|
7028
|
+
});
|
|
7029
|
+
return wire;
|
|
7030
|
+
}
|
|
7031
|
+
/** `GET /api/v1/network/profiles/{segment_id}` */
|
|
7032
|
+
async getProfile(segmentId) {
|
|
7033
|
+
const wire = await sendManagement(this.#client, {
|
|
7034
|
+
operation: "network.get_profile",
|
|
7035
|
+
method: "GET",
|
|
7036
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7037
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`
|
|
7038
|
+
});
|
|
7039
|
+
return wire;
|
|
7040
|
+
}
|
|
7041
|
+
/**
|
|
7042
|
+
* `PUT /api/v1/network/profiles/{segment_id}`
|
|
7043
|
+
*
|
|
7044
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7045
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7046
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7047
|
+
* the whole thing back.
|
|
7048
|
+
*
|
|
7049
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7050
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7051
|
+
*/
|
|
7052
|
+
async replaceProfile(segmentId, body) {
|
|
7053
|
+
const wire = await sendManagement(this.#client, {
|
|
7054
|
+
operation: "network.replace_profile",
|
|
7055
|
+
method: "PUT",
|
|
7056
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7057
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7058
|
+
body
|
|
7059
|
+
});
|
|
7060
|
+
return wire;
|
|
7061
|
+
}
|
|
7062
|
+
/**
|
|
7063
|
+
* `DELETE /api/v1/network/profiles/{segment_id}`
|
|
7064
|
+
*
|
|
7065
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7066
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7067
|
+
*/
|
|
7068
|
+
async deleteProfile(segmentId, version) {
|
|
7069
|
+
await sendManagement(this.#client, {
|
|
7070
|
+
operation: "network.delete_profile",
|
|
7071
|
+
method: "DELETE",
|
|
7072
|
+
pathTemplate: "/api/v1/network/profiles/{segment_id}",
|
|
7073
|
+
path: `/api/v1/network/profiles/${encodeURIComponent(segmentId)}`,
|
|
7074
|
+
query: { "version": String(version) }
|
|
7075
|
+
});
|
|
7076
|
+
}
|
|
7077
|
+
/** `GET /api/v1/network/policy` */
|
|
7078
|
+
async getPolicy() {
|
|
7079
|
+
const wire = await sendManagement(this.#client, {
|
|
7080
|
+
operation: "network.get_policy",
|
|
7081
|
+
method: "GET",
|
|
7082
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7083
|
+
path: "/api/v1/network/policy"
|
|
7084
|
+
});
|
|
7085
|
+
return wire;
|
|
7086
|
+
}
|
|
7087
|
+
/**
|
|
7088
|
+
* `PUT /api/v1/network/policy`
|
|
7089
|
+
*
|
|
7090
|
+
* **This is a replacement, not a patch** (§27.4 rule 5). Every field of the
|
|
7091
|
+
* body is required, and what you do not carry over from a prior read is not
|
|
7092
|
+
* preserved — it is overwritten. Read first, change the field you mean, send
|
|
7093
|
+
* the whole thing back.
|
|
7094
|
+
*
|
|
7095
|
+
* Not retried on failure (§27.4 rule 8): every write on this surface is
|
|
7096
|
+
* issued exactly once, including the ones that look idempotent.
|
|
7097
|
+
*/
|
|
7098
|
+
async replacePolicy(body) {
|
|
7099
|
+
const wire = await sendManagement(this.#client, {
|
|
7100
|
+
operation: "network.replace_policy",
|
|
7101
|
+
method: "PUT",
|
|
7102
|
+
pathTemplate: "/api/v1/network/policy",
|
|
7103
|
+
path: "/api/v1/network/policy",
|
|
7104
|
+
body
|
|
7105
|
+
});
|
|
7106
|
+
return wire;
|
|
7107
|
+
}
|
|
7108
|
+
};
|
|
7109
|
+
|
|
6506
7110
|
// src/management/ops/settings.ts
|
|
6507
7111
|
var SettingsApi = class _SettingsApi {
|
|
6508
7112
|
#client;
|
|
@@ -7127,6 +7731,9 @@ function managementNamespaces(client) {
|
|
|
7127
7731
|
get scimTargets() {
|
|
7128
7732
|
return new ScimTargetsApi(client);
|
|
7129
7733
|
},
|
|
7734
|
+
get network() {
|
|
7735
|
+
return new NetworkApi(client);
|
|
7736
|
+
},
|
|
7130
7737
|
get settings() {
|
|
7131
7738
|
return new SettingsApi(client);
|
|
7132
7739
|
},
|
|
@@ -7820,6 +8427,6 @@ function name(cls) {
|
|
|
7820
8427
|
return typeof cls === "function" && cls.name ? cls.name : String(cls);
|
|
7821
8428
|
}
|
|
7822
8429
|
|
|
7823
|
-
export { AuditApi, AuthError, AuthzError, AxiamClient, AxiamError, AxiamGrant, AxiamGroup, AxiamPermission, AxiamResource, AxiamRole, AxiamScope, AxiamServiceAccount, AxiamUser, BASE_DELAY_MS, CaCertificatesApi, CertificatesApi, ConflictError, DecisionMemo, DirectoryApi, EmailConfigApi, FederationApi, GroupsApi, KNOWN_SCIM_TARGET_AUTH_TYPES, KNOWN_SCIM_TARGET_SCOPE_TYPES, MAX_ATTEMPTS, MAX_DELAY_MS, MAX_TTL_MS, ManifestApi, NetworkError, NotFoundError, NotificationRulesApi, OAuthProtocolError, Oauth2ClientsApi, OpaqueUnavailableError, OrganizationsApi, PermissionsApi, PgpKeysApi, PlatformApi, PrivacyApi, ReactorsApi, ResourcesApi, RolesApi, SKIP_REFRESH, SamlApi, ScimTargetsApi, ScimTokensApi, ScopesApi, Sensitive, ServiceAccountsApi, SettingsApi, SharedSession, SsfApi, TelemetryDispatcher, TelemetryReporter, TenantsApi, UsersApi, ValidationError, WebauthnPolicyApi, WebhooksApi, assertKnownScimTargetAuth, assertKnownScimTargetScope, assertParseSpMetadataExactlyOne, assertValidSubjectAltName, assertValidSubjectAltNameList, backoffMs, changedCount, changes, classifyWebauthnError, clientRegistrationFromJson, collectManifest, collectPages, createFederationConfigRequestToWire, createRegistrationTokenResponseFromWire, createScimTokenResponseFromWire, createUserRequestToWire, createWebhookRequestToWire, defineManifest, delayMs, failure, generatedCaCertificateFromWire, generatedCertificateFromWire, generatedPgpKeyFromWire, hasMore, importCaCertificateRequestToWire, inheritOf, isComplete, isConverged, managementNamespaces, memoKey, normalizeSearch, oAuth2ClientCreatedResponseFromWire, omitEmptyTenantScope, opaqueAvailable, opaqueEnrollment, opaqueEnrollmentForSelf, pageQuery, parseFieldErrors, parseSpMetadataFromUrl, parseSpMetadataFromXml, resourceKeyOf, roleAssignmentInherits, roleKeyOf, rotateSecretResponseFromWire, samlServiceProviderInputFrom, scimTargetInputFrom, scimTargetInputToWire, scrubDirectoryConfig, scrubDirectoryLinkResult, scrubDirectorySyncStatus, scrubSamlIdpCredential, scrubSamlIdpCredentialPromotion, scrubSamlIdpInfo, scrubSamlServiceProvider, scrubSamlSpMetadataDraft, scrubScimReconcileAccepted, scrubScimTargetResponse, scrubSsfStream, serviceAccountCreatedResponseFromWire, setDirectoryConfigFrom, setDirectoryConfigToWire, ssfStreamInputFrom, ssfStreamInputToWire, topologicalOrder, updateDirectoryConfigToWire, updateFederationConfigRequestToWire, updateWebhookRequestToWire, validate, webauthnErrorMessage, webauthnRequestJson, withFederationConfigResponseDefaults, withRetry };
|
|
8430
|
+
export { AuditApi, AuthError, AuthzError, AxiamClient, AxiamError, AxiamGrant, AxiamGroup, AxiamPermission, AxiamResource, AxiamRole, AxiamScope, AxiamServiceAccount, AxiamUser, BASE_DELAY_MS, CaCertificatesApi, CertificatesApi, ConflictError, DecisionMemo, DirectoryApi, EmailConfigApi, FederationApi, GroupsApi, KNOWN_SCIM_TARGET_AUTH_TYPES, KNOWN_SCIM_TARGET_SCOPE_TYPES, MAX_ATTEMPTS, MAX_DELAY_MS, MAX_TTL_MS, ManifestApi, NetworkApi, NetworkError, NotFoundError, NotificationRulesApi, OAuthProtocolError, Oauth2ClientsApi, OpaqueUnavailableError, OrganizationsApi, PermissionsApi, PgpKeysApi, PlatformApi, PrivacyApi, ReactorsApi, ResourcesApi, RolesApi, SKIP_REFRESH, SamlApi, ScimTargetsApi, ScimTokensApi, ScopesApi, Sensitive, ServiceAccountsApi, SettingsApi, SharedSession, SsfApi, TelemetryDispatcher, TelemetryReporter, TenantsApi, UsersApi, ValidationError, WebauthnPolicyApi, WebhooksApi, assertKnownScimTargetAuth, assertKnownScimTargetScope, assertParseSpMetadataExactlyOne, assertValidSubjectAltName, assertValidSubjectAltNameList, backoffMs, changedCount, changes, classifyWebauthnError, clientRegistrationFromJson, collectManifest, collectPages, createFederationConfigRequestToWire, createRegistrationTokenResponseFromWire, createScimTokenResponseFromWire, createUserRequestToWire, createWebhookRequestToWire, defineManifest, delayMs, failure, generatedCaCertificateFromWire, generatedCertificateFromWire, generatedPgpKeyFromWire, hasMore, importCaCertificateRequestToWire, inheritOf, isComplete, isConverged, managementNamespaces, memoKey, normalizeSearch, oAuth2ClientCreatedResponseFromWire, omitEmptyTenantScope, omitNullMembers, opaqueAvailable, opaqueEnrollment, opaqueEnrollmentForSelf, pageQuery, parseFieldErrors, parseSpMetadataFromUrl, parseSpMetadataFromXml, resourceKeyOf, roleAssignmentInherits, roleKeyOf, rotateSecretResponseFromWire, samlServiceProviderInputFrom, scimTargetInputFrom, scimTargetInputToWire, scrubDirectoryConfig, scrubDirectoryLinkResult, scrubDirectorySyncStatus, scrubSamlIdpCredential, scrubSamlIdpCredentialPromotion, scrubSamlIdpInfo, scrubSamlServiceProvider, scrubSamlSpMetadataDraft, scrubScimReconcileAccepted, scrubScimTargetResponse, scrubSsfStream, serviceAccountCreatedResponseFromWire, setDirectoryConfigFrom, setDirectoryConfigToWire, ssfStreamInputFrom, ssfStreamInputToWire, ssfStreamInputWith, topologicalOrder, updateDirectoryConfigToWire, updateFederationConfigRequestToWire, updateWebhookRequestToWire, validate, webauthnErrorMessage, webauthnRequestJson, withFederationConfigResponseDefaults, withRetry };
|
|
7824
8431
|
//# sourceMappingURL=index.mjs.map
|
|
7825
8432
|
//# sourceMappingURL=index.mjs.map
|