@leaflow/sdk 0.29.0 → 0.30.0

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.
@@ -58,6 +58,8 @@ export type GetServerSnapshotResult = operations["get-server-snapshot"]["respons
58
58
  export type ListProjectTopItemsResult = operations["list-project-top-items"]["responses"][200]["content"]["application/json"];
59
59
  /** `GET /api/v1/top-items` 的查询参数。 */
60
60
  export type ListProjectTopItemsQuery = operations["list-project-top-items"]["parameters"]["query"];
61
+ /** `GET /api/v1/templates` 成功时的响应体。 */
62
+ export type ListTemplatesResult = operations["list-templates"]["responses"][200]["content"]["application/json"];
61
63
  /** `GET /api/v1/servers` 成功时的响应体。 */
62
64
  export type ListServersResult = operations["list-servers"]["responses"][200]["content"]["application/json"];
63
65
  /** `GET /api/v1/servers` 的查询参数。 */
@@ -331,6 +331,26 @@ export interface paths {
331
331
  patch?: never;
332
332
  trace?: never;
333
333
  };
334
+ "/api/v1/templates": {
335
+ parameters: {
336
+ query?: never;
337
+ header?: never;
338
+ path?: never;
339
+ cookie?: never;
340
+ };
341
+ /**
342
+ * List the monitoring templates that can be bound to a machine
343
+ * @description The catalog every template binding is validated against — which templates exist, which parameters each of them accepts, and what each parameter defaults to. It is identical for every project and changes only when this deployment is upgraded. Read it rather than keeping a copy. A copy drifts, and only one of the ways it drifts fails loudly — an unknown parameter name is rejected, but a stale `default` and a stale `required` both look correct on screen.
344
+ */
345
+ get: operations["list-templates"];
346
+ put?: never;
347
+ post?: never;
348
+ delete?: never;
349
+ options?: never;
350
+ head?: never;
351
+ patch?: never;
352
+ trace?: never;
353
+ };
334
354
  "/api/v1/servers": {
335
355
  parameters: {
336
356
  query?: never;
@@ -366,6 +386,8 @@ export interface paths {
366
386
  * A failed call leaves the machine recorded with `monitoring_status: FAILED`; the reason is reported in `last_error` via `GET /servers/{serverId}`.
367
387
  *
368
388
  * The `tls_psk` in the response is **returned only this once**; store it immediately. If it is lost, it must be rotated.
389
+ *
390
+ * It is also how collection is resumed after `/disable`. On a machine that already exists, **omitting `template_bindings` keeps the bindings it already has**; it does not fall back to the default of Linux alone, which would silently drop every other template together with its parameters. Secret parameters are likewise carried over — see `parameters` on the binding.
369
391
  */
370
392
  put: operations["enable-server-monitoring"];
371
393
  post?: never;
@@ -1291,6 +1313,46 @@ export interface components {
1291
1313
  TopItemListResponseBody: {
1292
1314
  items: components["schemas"]["TopItemResource"][] | null;
1293
1315
  };
1316
+ TemplateCatalogParameterResource: {
1317
+ /** @description The value that takes effect when the parameter is omitted. An empty string is a real default, not an absent one */
1318
+ default: string;
1319
+ /**
1320
+ * @description The shape of the accepted value. Surrounding whitespace is trimmed before the value is checked, and an omitted or empty value is replaced by `default` and not checked at all.
1321
+ *
1322
+ * - `string` — no constraint; empty is accepted
1323
+ * - `non_empty_string` — must not be empty once trimmed
1324
+ * - `percent` — a number in the **closed** interval 0 to 100; fractions are accepted
1325
+ * - `positive_number` — a number **strictly** greater than 0; fractions are accepted
1326
+ * - `port` — an integer from 1 to 65535 inclusive; `8080/tcp` is not a port
1327
+ * - `host` — an IP address, or a hostname of at most 255 characters whose dot-separated labels are at most 63 characters of `A-Z a-z 0-9 - _` and neither begin nor end with `-`. A single label such as `localhost` is accepted, as is a trailing dot
1328
+ * - `ip_or_empty` — an IP address, or empty to mean "not specified"
1329
+ * - `regexp` — must compile as a **Go RE2** pattern. RE2 has no backreferences and no lookaround, so a pattern that a browser's `new RegExp()` accepts may still be rejected here. Validating client-side narrows the gap but does not close it
1330
+ * @enum {string}
1331
+ */
1332
+ kind: "string" | "non_empty_string" | "percent" | "positive_number" | "port" | "host" | "ip_or_empty" | "regexp";
1333
+ /** @description The key to use in `template_bindings[].parameters`. It is not the Zabbix macro name, which is internal and changes between Zabbix versions */
1334
+ name: string;
1335
+ /** @description Independent of `default`. The three NGINX connection parameters carry a default and are still required, because the template's own default (localhost:80/basic_status) is almost never right */
1336
+ required: boolean;
1337
+ /** @description Supplied in clear text and never returned. A configured one is reported by name only, through `configured_secret_parameters` on the bound template. When updating a machine that already has one stored, omit it to keep the stored value and supply it only to replace it — a caller cannot read it back, so requiring it on every write would make resuming collection impossible */
1338
+ secret: boolean;
1339
+ };
1340
+ TemplateCatalogEntryResource: {
1341
+ /** @description Exactly one template with this set must be bound to every machine. Binding none enrolls a machine that can never alert; binding both loads the Linux and Windows items onto one machine, half of which must fail */
1342
+ is_base: boolean;
1343
+ /** @description False means the template collects without an agent on the machine — ICMP_PING is pinged by the Zabbix server, PROXMOX_VE is polled over the PVE API */
1344
+ needs_agent: boolean;
1345
+ /** @description In declaration order — connection parameters first, thresholds after — and meant to be rendered in that order. It is deliberately not alphabetical, which would split a template's connection parameters apart with thresholds between them even though they only make sense filled in together */
1346
+ parameters: components["schemas"]["TemplateCatalogParameterResource"][] | null;
1347
+ /** @description Templates that must be bound alongside this one. Values are `template_key`s */
1348
+ requires: string[] | null;
1349
+ /** @description Whether this template may be bound when `agent_mode` is ACTIVE. It already combines both reasons it may not be — no active variant exists, or this deployment does not have one installed — because the two are rejected identically and call for the same fix */
1350
+ supports_active_mode: boolean;
1351
+ template_key: string;
1352
+ };
1353
+ TemplateCatalogResponseBody: {
1354
+ items: components["schemas"]["TemplateCatalogEntryResource"][] | null;
1355
+ };
1294
1356
  ServerTemplateResource: {
1295
1357
  configured_secret_parameters: string[] | null;
1296
1358
  parameters: {
@@ -1348,7 +1410,11 @@ export interface components {
1348
1410
  total: number;
1349
1411
  };
1350
1412
  TemplateBindingRequest: {
1351
- /** @description Parameters declared by the template. Secret parameters are supplied in clear text and returned by name only */
1413
+ /**
1414
+ * @description Parameters declared by the template, keyed by `name` from `GET /templates`. This is a full replacement: a parameter that is omitted takes the `default` reported there, so send back the whole `parameters` map read from the machine rather than only the field being changed.
1415
+ *
1416
+ * Secret parameters are the one exception, because they are never returned and so cannot be sent back. Omit one to keep the value already stored, and supply it only to replace it. An empty or blank value counts as omitted.
1417
+ */
1352
1418
  parameters?: {
1353
1419
  [key: string]: string;
1354
1420
  };
@@ -2625,6 +2691,35 @@ export interface operations {
2625
2691
  };
2626
2692
  };
2627
2693
  };
2694
+ "list-templates": {
2695
+ parameters: {
2696
+ query?: never;
2697
+ header?: never;
2698
+ path?: never;
2699
+ cookie?: never;
2700
+ };
2701
+ requestBody?: never;
2702
+ responses: {
2703
+ /** @description OK */
2704
+ 200: {
2705
+ headers: {
2706
+ [name: string]: unknown;
2707
+ };
2708
+ content: {
2709
+ "application/json": components["schemas"]["TemplateCatalogResponseBody"];
2710
+ };
2711
+ };
2712
+ /** @description Error */
2713
+ default: {
2714
+ headers: {
2715
+ [name: string]: unknown;
2716
+ };
2717
+ content: {
2718
+ "application/json": components["schemas"]["Error"];
2719
+ };
2720
+ };
2721
+ };
2722
+ };
2628
2723
  "list-servers": {
2629
2724
  parameters: {
2630
2725
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {