@bussolabs/closeyourit-cli 0.18.0 → 0.19.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.
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class ServersIgnoredContainers extends BaseCommand {
3
+ static args: {
4
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ clear: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ set: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ private render;
14
+ private split;
15
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_1 = require("../../base");
5
+ // CYRA-519 — i nomi che su una macchina NON sono servizi (container di compilazione e test, che
6
+ // nascono e muoiono a ogni lavorazione) si scrivevano solo dalla pagina web: chi lavora da terminale
7
+ // doveva aprire il browser per una lista di due righe.
8
+ //
9
+ // Senza flag il comando legge; --set sostituisce l'elenco, --clear lo svuota. Sostituisce e non
10
+ // accoda: un elenco di due nomi si riscrive per intero, e "aggiungi" andrebbe letto prima.
11
+ class ServersIgnoredContainers extends base_1.BaseCommand {
12
+ static args = {
13
+ id: core_1.Args.string({ description: 'Server id', required: true }),
14
+ };
15
+ static description = 'Read or set the container names this server does not treat as services';
16
+ static examples = [
17
+ '<%= config.bin %> servers ignored-containers <server-id>',
18
+ '<%= config.bin %> servers ignored-containers <server-id> --set buildkit,runner',
19
+ '<%= config.bin %> servers ignored-containers <server-id> --clear',
20
+ ];
21
+ static flags = {
22
+ clear: core_1.Flags.boolean({ description: 'Remove every ignored container name', exclusive: ['set'] }),
23
+ set: core_1.Flags.string({ description: 'Comma-separated names to ignore (replaces the list)' }),
24
+ };
25
+ async run() {
26
+ const { args, flags } = await this.parse(ServersIgnoredContainers);
27
+ const path = `/cli/v1/servers/${encodeURIComponent(args.id)}`;
28
+ if (flags.set === undefined && !flags.clear) {
29
+ const res = await this.api.get(path);
30
+ if (!this.jsonEnabled())
31
+ this.log(this.render(res.data));
32
+ return res;
33
+ }
34
+ const patterns = flags.clear ? [] : this.split(flags.set ?? '');
35
+ const res = await this.api.put(path, { ignored_container_patterns: patterns });
36
+ if (!this.jsonEnabled())
37
+ this.log(this.render(res.data));
38
+ return res;
39
+ }
40
+ render(data) {
41
+ const patterns = data?.ignored_container_patterns ?? [];
42
+ return patterns.length === 0 ? 'No ignored container names' : patterns.join('\n');
43
+ }
44
+ split(value) {
45
+ return value
46
+ .split(',')
47
+ .map((name) => name.trim())
48
+ .filter(Boolean);
49
+ }
50
+ }
51
+ exports.default = ServersIgnoredContainers;
@@ -1,2 +1,9 @@
1
- /** Event types accepted by alert rules — mirror of the backend enum (Alerting::Rule). */
1
+ /**
2
+ * Event types accepted by alert rules — mirror of the backend enum (Alerting::Rule).
3
+ *
4
+ * CYRA-519: the list had stopped at the first fifteen, so `--event-type` rejected every type added
5
+ * since (containers, replication, inodes, automation, vulnerabilities…) — the flag looked broken
6
+ * while the backend accepted them. Keep this in the same order as the backend enum: appending there
7
+ * means appending here.
8
+ */
2
9
  export declare const ALERT_EVENT_TYPES: string[];
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ALERT_EVENT_TYPES = void 0;
4
- /** Event types accepted by alert rules — mirror of the backend enum (Alerting::Rule). */
4
+ /**
5
+ * Event types accepted by alert rules — mirror of the backend enum (Alerting::Rule).
6
+ *
7
+ * CYRA-519: the list had stopped at the first fifteen, so `--event-type` rejected every type added
8
+ * since (containers, replication, inodes, automation, vulnerabilities…) — the flag looked broken
9
+ * while the backend accepted them. Keep this in the same order as the backend enum: appending there
10
+ * means appending here.
11
+ */
5
12
  exports.ALERT_EVENT_TYPES = [
6
13
  'error_new',
7
14
  'error_regression',
@@ -18,4 +25,32 @@ exports.ALERT_EVENT_TYPES = [
18
25
  'server_temp',
19
26
  'server_service_failed',
20
27
  'server_smart_failing',
28
+ 'error_spike',
29
+ 'log_alert',
30
+ 'server_db_down',
31
+ 'server_db_connections',
32
+ 'server_replication_lag',
33
+ 'agents_stalled',
34
+ 'server_container_down',
35
+ 'agents_host_failing',
36
+ 'uptime_slow',
37
+ 'analytics_traffic_drop',
38
+ 'analytics_traffic_spike',
39
+ 'idea_created',
40
+ 'idea_commented',
41
+ 'workload_due_soon',
42
+ 'dataset_training_completed',
43
+ 'dataset_training_failed',
44
+ 'agents_host_stale',
45
+ 'vulnerability_new',
46
+ 'runtime_eol',
47
+ 'embedding_down',
48
+ 'server_container_up',
49
+ 'server_db_connection_usage',
50
+ 'server_data_volume_disk',
51
+ 'server_inode',
52
+ 'server_replication_down',
53
+ 'server_replication_up',
54
+ 'server_container_restart_loop',
55
+ 'server_container_stable',
21
56
  ];