diff --git a/go.mod b/go.mod index 88a23d1..039336b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/flashcatcloud/flashduty-cli go 1.25.1 require ( - github.com/flashcatcloud/go-flashduty v0.14.0 + github.com/flashcatcloud/go-flashduty v0.14.1 github.com/mattn/go-runewidth v0.0.27 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 diff --git a/go.sum b/go.sum index 3a7bf62..fa5831d 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/flashcatcloud/go-flashduty v0.14.0 h1:mKC7MhwA2EzTFa7S+ShLChzMQwcDtOV2oZc4xepTZWA= -github.com/flashcatcloud/go-flashduty v0.14.0/go.mod h1:aA0RtZEs0AYOwwdNKdtVeD8YMOdnmVY1zAlVD+9Ovx8= +github.com/flashcatcloud/go-flashduty v0.14.1 h1:yrpKPuMJuC1z8bhIaZfGV66lb+sAsBUcqOZZsFZjsiI= +github.com/flashcatcloud/go-flashduty v0.14.1/go.mod h1:aA0RtZEs0AYOwwdNKdtVeD8YMOdnmVY1zAlVD+9Ovx8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/mattn/go-runewidth v0.0.27 h1:Feg/Oou5zI/wnpgDF6omIU0OokC9GxLC/WRknhVlIR0= diff --git a/internal/cli/zz_generated_a2a_agents.go b/internal/cli/zz_generated_a2a_agents.go index 8948f31..85761ec 100644 --- a/internal/cli/zz_generated_a2a_agents.go +++ b/internal/cli/zz_generated_a2a_agents.go @@ -32,7 +32,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - allow_insecure_oauth_http (boolean) — Allow non-loopback HTTP OAuth discovery/metadata endpoints for this agent instead of requiring HTTPS. - allow_insecure_tls_skip_verify (boolean) — Skip TLS certificate verification when connecting to this agent's endpoint. - auth_config (object) — Authentication config; sensitive values ('api_key', 'token', 'client_secret') are masked. - - auth_mode (string) — Authentication mode. [shared, per_user_secret, per_user_oauth] + - auth_mode (string) — Authentication mode. One of: 'shared' (a single static credential saved on the resource and shared by all callers in the account; the default — an empty value behaves the same), 'per_user_secret' (each user stores their own secret per 'secret_schema', injected per user at runtime), 'per_user_oauth' (each user completes their own OAuth grant; discovery and registration run lazily on first use). [shared, per_user_secret, per_user_oauth] - auth_type (string) (required) — Authentication type for reaching the remote agent: 'none', 'api_key', or 'bearer'. - can_edit (boolean) (required) — Whether the caller may edit this agent. - card_resolve_timeout (integer) (required) — Card-resolution timeout in seconds. Always 0 today — the API does not yet expose a way to set it. @@ -118,7 +118,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; - allow_insecure_oauth_http (boolean) — Allow non-loopback HTTP OAuth discovery/metadata endpoints for this agent instead of requiring HTTPS. - allow_insecure_tls_skip_verify (boolean) — Skip TLS certificate verification when connecting to this agent's endpoint. - auth_config (object) — Authentication config; sensitive values ('api_key', 'token', 'client_secret') are masked. - - auth_mode (string) — Authentication mode. [shared, per_user_secret, per_user_oauth] + - auth_mode (string) — Authentication mode. One of: 'shared' (a single static credential saved on the resource and shared by all callers in the account; the default — an empty value behaves the same), 'per_user_secret' (each user stores their own secret per 'secret_schema', injected per user at runtime), 'per_user_oauth' (each user completes their own OAuth grant; discovery and registration run lazily on first use). [shared, per_user_secret, per_user_oauth] - auth_type (string) (required) — Authentication type for reaching the remote agent: 'none', 'api_key', or 'bearer'. - can_edit (boolean) (required) — Whether the caller may edit this agent. - card_resolve_timeout (integer) (required) — Card-resolution timeout in seconds. Always 0 today — the API does not yet expose a way to set it. diff --git a/internal/cli/zz_generated_alert_enrichment.go b/internal/cli/zz_generated_alert_enrichment.go index 6d52875..99d01a7 100644 --- a/internal/cli/zz_generated_alert_enrichment.go +++ b/internal/cli/zz_generated_alert_enrichment.go @@ -252,12 +252,12 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - display_name (string) (required) — Human-readable name shown in the UI. (≤39 chars) - field_id (string) (required) — Field ID — 24-character hex ObjectID. - field_name (string) (required) — Machine name used in incident payloads under 'fields.'. Immutable. (≤39 chars) - - field_type (string) (required) — Field input type. [checkbox, multi_select, single_select, text] + - field_type (string) (required) — Field type. | Value | Meaning | |---|---| | 'checkbox' | Checkbox; value is a bool, options are not supported. | | 'multi_select' | Multi-select; value is a string array, each element must be one of options. | | 'single_select' | Single-select; value is a string from options. | | 'text' | Free text; value is a string. | [checkbox, multi_select, single_select, text] - options (any) — Allowed choices for 'single_select'/'multi_select' (non-empty unique string array). 'null' or empty for 'checkbox'/'text'. - status (string) (required) — Field status (e.g. 'enabled', 'deleted'). - updated_at (string) (required) — Last update timestamp, Unix seconds. CLI '--json' renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value stays the bare integer 0. - updated_by (integer) (required) — Last updater member ID. - - value_type (string) (required) — Stored value type. 'checkbox' is always 'bool'; 'single_select'/'multi_select'/'text' are always 'string'. [string, bool, float] + - value_type (string) (required) — Value type. 'checkbox' is always 'bool'; 'single_select'/'multi_select'/'text' are always 'string'. 'float' is reserved and never occurs today. [string, bool, float] `, Args: requireBodyFieldOrExactArg("field_id", "field-id"), Example: ` flashduty field info --data '{"field_id":"66e9d3a4f7c2b04a1c8a91b3"}'`, @@ -324,12 +324,12 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; - display_name (string) (required) — Human-readable name shown in the UI. (≤39 chars) - field_id (string) (required) — Field ID — 24-character hex ObjectID. - field_name (string) (required) — Machine name used in incident payloads under 'fields.'. Immutable. (≤39 chars) - - field_type (string) (required) — Field input type. [checkbox, multi_select, single_select, text] + - field_type (string) (required) — Field type. | Value | Meaning | |---|---| | 'checkbox' | Checkbox; value is a bool, options are not supported. | | 'multi_select' | Multi-select; value is a string array, each element must be one of options. | | 'single_select' | Single-select; value is a string from options. | | 'text' | Free text; value is a string. | [checkbox, multi_select, single_select, text] - options (any) — Allowed choices for 'single_select'/'multi_select' (non-empty unique string array). 'null' or empty for 'checkbox'/'text'. - status (string) (required) — Field status (e.g. 'enabled', 'deleted'). - updated_at (string) (required) — Last update timestamp, Unix seconds. CLI '--json' renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value stays the bare integer 0. - updated_by (integer) (required) — Last updater member ID. - - value_type (string) (required) — Stored value type. 'checkbox' is always 'bool'; 'single_select'/'multi_select'/'text' are always 'string'. [string, bool, float] + - value_type (string) (required) — Value type. 'checkbox' is always 'bool'; 'single_select'/'multi_select'/'text' are always 'string'. 'float' is reserved and never occurs today. [string, bool, float] `, Example: ` flashduty field list --data '{"asc":false,"orderby":"updated_at","query":"severity"}'`, RunE: func(cmd *cobra.Command, args []string) error { @@ -395,7 +395,7 @@ Request fields: --field-name string (required) — Machine name. Must start with a letter or underscore; 1–40 chars of '[a-zA-Z0-9_]'. Immutable after creation. (≤39 chars) --field-type string (required) — Field type, immutable after creation: 'text', 'single_select', 'multi_select' or 'checkbox'. [checkbox, multi_select, single_select, text] --options []string — Required and non-empty for 'single_select'/'multi_select' (unique strings, each 1–200 chars). Must be omitted or empty for 'checkbox'/'text'. - --value-type string (required) — Stored value type. 'checkbox' requires 'bool'; 'single_select'/'multi_select'/'text' require 'string'. Immutable after creation. [string, bool, float] + --value-type string (required) — Value type. 'checkbox' requires 'bool'; all other types require 'string'. Immutable after creation. 'float' is a reserved value currently rejected for every 'field_type'. [string, bool, float] default_value (any, via --data) — Optional default value. Type must match 'field_type': 'bool' for checkbox; one of 'options' for single_select; subset of 'options' for multi_select; string ≤3000 chars for text. Response fields ('data' envelope is unwrapped — these fields are at the top level): @@ -446,7 +446,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le cmd.Flags().StringVar(&fFieldName, "field-name", "", "Machine name. Must start with a letter or underscore; 1–40 chars of '[a-zA-Z0-9_]'. Immutable after creation. (required) (≤39 chars)") cmd.Flags().StringVar(&fFieldType, "field-type", "", "Field type, immutable after creation: 'text', 'single_select', 'multi_select' or 'checkbox'. (required) [checkbox, multi_select, single_select, text]") cmd.Flags().StringSliceVar(&fOptions, "options", nil, "Required and non-empty for 'single_select'/'multi_select' (unique strings, each 1–200 chars). Must be omitted or empty for 'checkbox'/'text'.") - cmd.Flags().StringVar(&fValueType, "value-type", "", "Stored value type. 'checkbox' requires 'bool'; 'single_select'/'multi_select'/'text' require 'string'. Immutable after creation. (required) [string, bool, float]") + cmd.Flags().StringVar(&fValueType, "value-type", "", "Value type. 'checkbox' requires 'bool'; all other types require 'string'. Immutable after creation. 'float' is a reserved value currently rejected for every 'field_type'. (required) [string, bool, float]") cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; positional arguments and typed flags override its fields. Accepts inline JSON, or - to read stdin.") return cmd } diff --git a/internal/cli/zz_generated_alert_rules.go b/internal/cli/zz_generated_alert_rules.go index ba55e0a..c870192 100644 --- a/internal/cli/zz_generated_alert_rules.go +++ b/internal/cli/zz_generated_alert_rules.go @@ -24,13 +24,13 @@ Request fields: --id int (required) — Audit record ID — the 'id' of an audit row returned by 'POST /monit/rule/audits', NOT the rule ID. Passing a rule ID returns HTTP 400. Response fields ('data' envelope is unwrapped — these fields are at the top level): - - account_id (integer) (required) + - account_id (integer) (required) — ID of the account that owns the rule. - action (string) (required) — Action performed, e.g. 'create', 'update'. - alert_rule_id (integer) (required) — ID of the alert rule this record belongs to. - content (string) — JSON string of the full rule snapshot at audit time. Populated on '/monit/rule/audit/detail', omitted on list responses. - - created_at (integer) (required) - - creator_id (integer) (required) - - creator_name (string) (required) + - created_at (string) (required) — When this audit record was produced, as a Unix timestamp in seconds; equals the rule's 'updated_at' at change time. CLI '--json' renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value stays the bare integer 0. + - creator_id (integer) (required) — ID of the user who made this change (taken from the rule's 'updater_id' at change time). + - creator_name (string) (required) — Name of the user who made this change (taken from the rule's 'updater_name' at change time). - id (integer) (required) — Audit record ID. `, Example: ` flashduty monit rule-audit-detail --data '{"id":9001}'`, @@ -78,13 +78,13 @@ Request fields: --id int (required) — Alert rule ID. Obtainable per folder via 'POST /monit/rule/list/basic'. Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - - account_id (integer) (required) + - account_id (integer) (required) — ID of the account that owns the rule. - action (string) (required) — Action performed, e.g. 'create', 'update'. - alert_rule_id (integer) (required) — ID of the alert rule this record belongs to. - content (string) — JSON string of the full rule snapshot at audit time. Populated on '/monit/rule/audit/detail', omitted on list responses. - - created_at (integer) (required) - - creator_id (integer) (required) - - creator_name (string) (required) + - created_at (string) (required) — When this audit record was produced, as a Unix timestamp in seconds; equals the rule's 'updated_at' at change time. CLI '--json' renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value stays the bare integer 0. + - creator_id (integer) (required) — ID of the user who made this change (taken from the rule's 'updater_id' at change time). + - creator_name (string) (required) — Name of the user who made this change (taken from the rule's 'updater_name' at change time). - id (integer) (required) — Audit record ID. `, Example: ` flashduty monit rule-audits --data '{"id":50001}'`, @@ -194,8 +194,8 @@ Return trigger status summary for all top-level folder nodes — used for the ov API: POST /monit/rule/counter/status (monit-rule-read-counter-status) Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - - folder_id (integer) (required) - - folder_name (string) + - folder_id (integer) (required) — ID of the folder (grouping node). + - folder_name (string) — Folder name; omitted by some endpoints ('omitempty'). - rule_total (integer) (required) — Total rules in the folder family. - triggered_rule_count (integer) (required) — Rules with active alerts. `, @@ -233,9 +233,9 @@ Return the stored time series of the total rule count across the account — one API: POST /monit/rule/counter/total (monit-rule-read-counter-total) Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - - account_id (integer) (required) + - account_id (integer) (required) — ID of the account this snapshot belongs to. - clock (string) (required) — Sample timestamp, Unix epoch seconds. CLI '--json' renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value stays the bare integer 0. - - id (integer) (required) + - id (integer) (required) — ID of this snapshot record. - num (integer) (required) — Rule count at the sample time. `, Example: ` flashduty monit rule-counter-total --data '{}'`, @@ -273,7 +273,7 @@ API: POST /monit/rule/dstypes (monit-rule-read-dstypes) Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - account_id (integer) (required) — Owning account ID. '0' for global types. - - id (integer) (required) + - id (integer) (required) — ID of the datasource type record. - ident (string) (required) — Identifier used as the 'ds_type' of rules, e.g. 'prometheus'. - name (string) (required) — Display name, e.g. 'Prometheus'. - weight (integer) (required) — Display order weight; higher appears first. @@ -316,61 +316,63 @@ Request fields: --ids []int (required) — Rule IDs. Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - - annotations (object) - - cron_pattern (string) (required) - - debug_log_enabled (boolean) (required) - - delay_seconds (integer) - - description (string) - - description_type (string) [text, markdown] - - ds_ids (array) - - ds_list (array) - - ds_type (string) (required) - - enabled (boolean) (required) - - enabled_times (array) + - annotations (object) — Custom annotation key-value pairs attached to alert events; keys must not start with '$' (reserved for query field references). + - cron_pattern (string) (required) — Evaluation schedule as a 6-field cron expression (seconds included) or '@every ' (an integral number of seconds, at least 1s); 'CRON_TZ='/'TZ=' prefixes are rejected — set the timezone in 'timezone' instead. + - debug_log_enabled (boolean) (required) — Whether to emit debug logs for this rule's evaluations; enable when troubleshooting. + - delay_seconds (integer) — Query time offset in seconds: each evaluation reads data as of 'schedule time − delay_seconds' to tolerate ingestion lag; '0' means no offset. + - description (string) — Rule description in the format given by 'description_type', shown with alert events. + - description_type (string) — Format of 'description', 'text' or 'markdown'; treated as 'text' when omitted. [text, markdown] + - ds_ids (array) — Datasource ID list, merged with 'ds_list'; references by ID and is therefore immune to datasource renames. + - ds_list (array) — Datasource name list with wildcard support; merged with 'ds_ids' to decide which datasources the rule monitors — must be maintained by hand if a datasource is renamed. + - ds_type (string) (required) — Datasource type ident, e.g. 'prometheus'; must be a datasource type ('ident') that exists in the import target environment. + - enabled (boolean) (required) — Whether the rule is enabled; rules imported as disabled are not evaluated. + - enabled_times (array) — Effective time windows; each entry has 'days' (0–6, 0 = Sunday) and 'stime'/'etime' ('HH:MM'), interpreted in the rule's 'timezone'; an empty list disables the rule. - days (array) — Days of week, 0 = Sunday. - etime (string) — End time, e.g. '18:00'. - stime (string) — Start time, e.g. '09:00'. - - labels (object) - - name (string) (required) - - repeat_interval (integer) - - repeat_total (integer) + - labels (object) — Custom label key-value pairs attached to alert events produced by this rule. + - name (string) (required) — Rule name, up to 128 characters when imported. + - repeat_interval (integer) — Interval in seconds between repeated notifications for a firing alert; values below 1 fall back to the default of 3600. + - repeat_total (integer) — Maximum number of repeated notifications for the same alert; values below 1 fall back to the default of 3. - rule_configs (object) — Rule evaluation configuration. - check_anydata (object) — Any-data check configuration. Fires when the query returns any data rows. - - alerting_check_times (integer) - - enabled (boolean) - - push_recovery_event (boolean) + - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. + - enabled (boolean) — Whether any-data checking is enabled: any returned data row triggers an alert. + - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. - recovery (object) — Recovery condition for any-data check. If omitted or 'mode' is empty, treated as 'nodata'. - - args (object) + - args (object) — Datasource-specific options for the recovery query, same convention as 'queries[].args'; required for Elasticsearch datasources when 'mode' is 'ql'. - condition (string) — Recovery expression. Required when 'mode' is 'ql'. - mode (string) — 'nodata' = recover when the query returns no data; 'ql' = recover when the 'condition' expression evaluates to true. When 'mode' is 'ql', only a single query ('name=A') is permitted. [nodata, ql] - - recovery_check_times (integer) - - severity (string) [Critical, Warning, Info] + - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. + - severity (string) — Severity of any-data alert events; case-sensitive. [Critical, Warning, Info] - check_nodata (object) — No-data check configuration. - - alerting_check_times (integer) - - enabled (boolean) - - push_recovery_event (boolean) - - recovery_check_times (integer) + - alert_on_empty_result (boolean) — Whether to trigger an alert when every query returns an empty result. + - alert_on_empty_result_severity (string) — Severity of empty-result alerts, case-sensitive; only effective when 'alert_on_empty_result' is enabled. [Critical, Warning, Info] + - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. + - enabled (boolean) — Whether no-data checking is enabled: a previously-seen series that stops returning data triggers an alert. + - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. + - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. - resolve_timeout (integer) — Auto-resolve after N seconds. - - severity (string) [Critical, Warning, Info] + - severity (string) — Severity of no-data alert events; case-sensitive. [Critical, Warning, Info] - check_threshold (object) — Threshold check configuration. - - alerting_check_times (integer) - - critical (string) - - enabled (boolean) - - info (string) - - push_recovery_event (boolean) - - recovery (object) - - condition (string) - - mode (string) [invert, threshold, ql] - - recovery_check_times (integer) - - warning (string) - - queries (array) - - args (object) + - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. + - critical (string) — Critical threshold expression referencing query results via '$' or '$.', e.g. '$A > 90'; at least one severity must be configured. + - enabled (boolean) — Whether threshold checking is enabled. + - info (string) — Info threshold expression, same syntax as 'critical'. + - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. + - recovery (object) — Recovery evaluation configuration for threshold checks. + - condition (string) — Recovery condition expression; required when 'mode' is 'threshold' or 'ql', and must be empty for 'invert'. + - mode (string) — Recovery mode: 'invert' = resolve when the alert expression no longer holds ('condition' stays empty); 'threshold' = resolve when the 'condition' threshold expression holds; 'ql' = resolve when the 'condition' query expression evaluates true. [invert, threshold, ql] + - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. + - warning (string) — Warning threshold expression, same syntax as 'critical'. + - queries (array) — Query list with at least one entry; each needs a unique 'name' ('R' and '__all__' are reserved) and a non-empty, non-duplicate 'expr'. + - args (object) — Datasource-specific query options keyed by the '.