From 1bf9eaade5399f6c291c67fc9896f720ca7bd853 Mon Sep 17 00:00:00 2001 From: caballeto Date: Wed, 6 May 2026 15:55:06 +0200 Subject: [PATCH] chore: refresh OpenAPI spec + accept optional managedBy mono#369 made managedBy optional on CreateMonitorRequest (server defaults to "API" / surface-injected value), added managedBy to RG/StatusPage/ AlertChannel responses, and added MonitorDto.currentStatus. - regen src/generated/api.ts from fresh spec - flip "rejects missing managedBy" -> "accepts missing managedBy" to match the new contract (sdk-python#26 made the same change) Fixes the spec-check failure that fired on the spec_updated dispatch after mono#369 was merged. Co-authored-by: Cursor --- docs/openapi/monitoring-api.json | 210 +++++++++++++++++++++++++++++-- src/generated/api.ts | 96 +++++++++++--- test/negative-validation.test.ts | 8 +- 3 files changed, 286 insertions(+), 28 deletions(-) diff --git a/docs/openapi/monitoring-api.json b/docs/openapi/monitoring-api.json index 02f8524..b60c933 100644 --- a/docs/openapi/monitoring-api.json +++ b/docs/openapi/monitoring-api.json @@ -166,8 +166,52 @@ "Alert Channels" ], "summary": "List active alert channels for the authenticated org", + "description": "Supports filtering by `type` (channel integration), `managedBy` (creating surface), and `search` (case-insensitive contains on name). Unrecognised query parameters are silently ignored — pin to the documented set above.", "operationId": "list_14", "parameters": [ + { + "name": "type", + "in": "query", + "description": "Filter by channel integration type (e.g. SLACK, WEBHOOK, EMAIL)", + "required": false, + "schema": { + "type": "string", + "enum": [ + "email", + "webhook", + "slack", + "pagerduty", + "opsgenie", + "teams", + "discord" + ] + } + }, + { + "name": "managedBy", + "in": "query", + "description": "Filter by managed-by source (DASHBOARD, CLI, TERRAFORM, MCP, API)", + "required": false, + "schema": { + "type": "string", + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] + } + }, + { + "name": "search", + "in": "query", + "description": "Case-insensitive contains-match on the channel name", + "required": false, + "schema": { + "type": "string" + } + }, { "name": "pageable", "in": "query", @@ -6374,17 +6418,27 @@ "Monitors" ], "summary": "List monitors for the authenticated org", + "description": "Supports filtering by `enabled`, `status` (alias active|paused for enabled), `type`, `managedBy`, `tag` / `tags`, `search`, and `environmentId`. Unrecognised query parameters are silently ignored (Spring's default binding behaviour) — pin to the documented set above.", "operationId": "list_8", "parameters": [ { "name": "enabled", "in": "query", - "description": "Filter by enabled state", + "description": "Filter by enabled state (true/false)", "required": false, "schema": { "type": "boolean" } }, + { + "name": "status", + "in": "query", + "description": "Lifecycle status alias: 'active' (enabled=true) or 'paused' (enabled=false). Ignored when ?enabled is also supplied.", + "required": false, + "schema": { + "type": "string" + } + }, { "name": "type", "in": "query", @@ -6421,7 +6475,16 @@ { "name": "tags", "in": "query", - "description": "Filter by tag names, comma-separated (e.g. prod,critical)", + "description": "Filter by tag names, comma-separated (e.g. prod,critical); OR semantics", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "tag", + "in": "query", + "description": "Filter by a single tag name (alias for ?tags=); merged with ?tags using OR semantics", "required": false, "schema": { "type": "string" @@ -21729,6 +21792,18 @@ "description": "SHA-256 hash of the channel config; use for change detection", "nullable": true }, + "managedBy": { + "type": "string", + "description": "Source that created/owns this channel: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on channels created before this attribution column existed.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] + }, "lastDeliveryAt": { "type": "string", "description": "Timestamp of the most recent delivery attempt", @@ -22929,6 +23004,18 @@ "$ref": "#/components/schemas/WebhookChannelConfig" } ] + }, + "managedBy": { + "type": "string", + "description": "Source creating this channel: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } } }, @@ -23189,12 +23276,14 @@ "maxLength": 100, "minLength": 0, "type": "string", - "description": "iCal RRULE for recurring windows (max 100 chars); null for one-time", + "description": "Reserved: iCal RRULE for recurring windows (stored but not yet honored)", "nullable": true }, "reason": { + "maxLength": 500, + "minLength": 0, "type": "string", - "description": "Human-readable reason for the maintenance", + "description": "Human-readable reason for the maintenance (max 500 chars)", "nullable": true }, "suppressAlerts": { @@ -23241,7 +23330,6 @@ "CreateMonitorRequest": { "required": [ "config", - "managedBy", "name", "type" ], @@ -23309,7 +23397,8 @@ }, "managedBy": { "type": "string", - "description": "Source that created/owns this monitor: DASHBOARD, CLI, TERRAFORM, MCP, or API. Use the value matching your surface so audit logs, drift detection, and analytics attribute correctly.", + "description": "Source that created/owns this monitor: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted; set to your surface so audit logs, drift detection, and analytics attribute correctly.", + "nullable": true, "enum": [ "DASHBOARD", "CLI", @@ -23510,6 +23599,18 @@ "description": "Recovery cooldown in minutes after group incident resolves (0–60)", "format": "int32", "nullable": true + }, + "managedBy": { + "type": "string", + "description": "Source creating this group: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } }, "description": "Request body for creating a resource group" @@ -23811,6 +23912,18 @@ "REVIEW", "AUTOMATIC" ] + }, + "managedBy": { + "type": "string", + "description": "Source creating this page: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } } }, @@ -26436,7 +26549,7 @@ }, "repeatRule": { "type": "string", - "description": "iCal RRULE for recurring windows; null for one-time", + "description": "Reserved: iCal RRULE for recurring windows (stored but not yet honored)", "nullable": true }, "reason": { @@ -27271,6 +27384,18 @@ "description": "Alert channel IDs linked to this monitor; populated on single-monitor responses", "format": "uuid" } + }, + "currentStatus": { + "type": "string", + "description": "Current operational state — UP, DOWN, DEGRADED, PAUSED, or UNKNOWN if no probe data yet", + "nullable": true, + "enum": [ + "up", + "degraded", + "down", + "paused", + "unknown" + ] } }, "description": "Full monitor representation" @@ -28461,6 +28586,18 @@ "$ref": "#/components/schemas/ResourceGroupMemberDto" } }, + "managedBy": { + "type": "string", + "description": "Source that created/owns this group: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on groups created before this attribution column existed.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] + }, "createdAt": { "type": "string", "description": "Timestamp when the group was created", @@ -28721,6 +28858,7 @@ "up", "degraded", "down", + "paused", "unknown" ] }, @@ -31056,6 +31194,18 @@ "UNDER_MAINTENANCE" ] }, + "managedBy": { + "type": "string", + "description": "Source that created/owns this status page: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on pages created before this attribution column existed.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] + }, "createdAt": { "type": "string", "format": "date-time" @@ -32999,6 +33149,18 @@ "$ref": "#/components/schemas/WebhookChannelConfig" } ] + }, + "managedBy": { + "type": "string", + "description": "New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } } }, @@ -33239,7 +33401,7 @@ "properties": { "monitorId": { "type": "string", - "description": "Monitor to attach this maintenance window to; null preserves current", + "description": "Monitor this window applies to; null switches the window to org-wide", "format": "uuid", "nullable": true }, @@ -33257,17 +33419,19 @@ "maxLength": 100, "minLength": 0, "type": "string", - "description": "Updated iCal RRULE; null clears the repeat rule", + "description": "Reserved: iCal RRULE for recurring windows (stored but not yet honored); null clears it", "nullable": true }, "reason": { + "maxLength": 500, + "minLength": 0, "type": "string", - "description": "Updated reason; null clears the existing reason", + "description": "Updated reason (max 500 chars); null clears the existing reason", "nullable": true }, "suppressAlerts": { "type": "boolean", - "description": "Whether to suppress alerts; null preserves current", + "description": "Whether to suppress alerts during this window; null defaults to true", "nullable": true } } @@ -33605,6 +33769,18 @@ "description": "Recovery cooldown in minutes; null clears", "format": "int32", "nullable": true + }, + "managedBy": { + "type": "string", + "description": "New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } }, "description": "Request body for updating a resource group" @@ -33809,6 +33985,18 @@ "REVIEW", "AUTOMATIC" ] + }, + "managedBy": { + "type": "string", + "description": "New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value.", + "nullable": true, + "enum": [ + "DASHBOARD", + "CLI", + "TERRAFORM", + "MCP", + "API" + ] } } }, diff --git a/src/generated/api.ts b/src/generated/api.ts index 2f2f685..ceba7c8 100644 --- a/src/generated/api.ts +++ b/src/generated/api.ts @@ -11,7 +11,10 @@ export interface paths { path?: never; cookie?: never; }; - /** List active alert channels for the authenticated org */ + /** + * List active alert channels for the authenticated org + * @description Supports filtering by `type` (channel integration), `managedBy` (creating surface), and `search` (case-insensitive contains on name). Unrecognised query parameters are silently ignored — pin to the documented set above. + */ get: operations["list_14"]; put?: never; /** Create a new alert channel with encrypted config */ @@ -757,7 +760,10 @@ export interface paths { path?: never; cookie?: never; }; - /** List monitors for the authenticated org */ + /** + * List monitors for the authenticated org + * @description Supports filtering by `enabled`, `status` (alias active|paused for enabled), `type`, `managedBy`, `tag` / `tags`, `search`, and `environmentId`. Unrecognised query parameters are silently ignored (Spring's default binding behaviour) — pin to the documented set above. + */ get: operations["list_8"]; put?: never; /** Create a new monitor */ @@ -2502,6 +2508,11 @@ export interface components { updatedAt: string; /** @description SHA-256 hash of the channel config; use for change detection */ configHash?: string | null; + /** + * @description Source that created/owns this channel: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on channels created before this attribution column existed. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; /** * Format: date-time * @description Timestamp of the most recent delivery attempt @@ -3086,6 +3097,11 @@ export interface components { /** @description Human-readable name for this alert channel */ name: string; config: components["schemas"]["DiscordChannelConfig"] | components["schemas"]["EmailChannelConfig"] | components["schemas"]["OpsGenieChannelConfig"] | components["schemas"]["PagerDutyChannelConfig"] | components["schemas"]["SlackChannelConfig"] | components["schemas"]["TeamsChannelConfig"] | components["schemas"]["WebhookChannelConfig"]; + /** + * @description Source creating this channel: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; CreateApiKeyRequest: { /** @description Human-readable name to identify this API key */ @@ -3146,9 +3162,9 @@ export interface components { * @description Scheduled end of the maintenance window (ISO 8601) */ endsAt: string; - /** @description iCal RRULE for recurring windows (max 100 chars); null for one-time */ + /** @description Reserved: iCal RRULE for recurring windows (stored but not yet honored) */ repeatRule?: string | null; - /** @description Human-readable reason for the maintenance */ + /** @description Human-readable reason for the maintenance (max 500 chars) */ reason?: string | null; /** @description Whether to suppress alerts during this window (default: true) */ suppressAlerts?: boolean | null; @@ -3188,10 +3204,10 @@ export interface components { /** @description Probe regions to run checks from, e.g. us-east, eu-west */ regions?: string[] | null; /** - * @description Source that created/owns this monitor: DASHBOARD, CLI, TERRAFORM, MCP, or API. Use the value matching your surface so audit logs, drift detection, and analytics attribute correctly. - * @enum {string} + * @description Source that created/owns this monitor: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted; set to your surface so audit logs, drift detection, and analytics attribute correctly. + * @enum {string|null} */ - managedBy: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API"; + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; /** * Format: uuid * @description Environment to associate with this monitor @@ -3269,6 +3285,11 @@ export interface components { * @description Recovery cooldown in minutes after group incident resolves (0–60) */ recoveryCooldownMinutes?: number | null; + /** + * @description Source creating this group: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; CreateSecretRequest: { /** @description Unique secret key within the workspace (max 255 chars) */ @@ -3396,6 +3417,11 @@ export interface components { * @enum {string|null} */ incidentMode?: "MANUAL" | "REVIEW" | "AUTOMATIC" | null; + /** + * @description Source creating this page: DASHBOARD, CLI, TERRAFORM, MCP, or API. Defaults to API when omitted. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; /** @description Request body for creating a tag */ CreateTagRequest: { @@ -4613,7 +4639,7 @@ export interface components { * @description Scheduled end of the maintenance window */ endsAt: string; - /** @description iCal RRULE for recurring windows; null for one-time */ + /** @description Reserved: iCal RRULE for recurring windows (stored but not yet honored) */ repeatRule?: string | null; /** @description Human-readable reason for the maintenance */ reason?: string | null; @@ -4859,6 +4885,11 @@ export interface components { incidentPolicy?: components["schemas"]["IncidentPolicyDto"] | null; /** @description Alert channel IDs linked to this monitor; populated on single-monitor responses */ alertChannelIds?: string[] | null; + /** + * @description Current operational state — UP, DOWN, DEGRADED, PAUSED, or UNKNOWN if no probe data yet + * @enum {string|null} + */ + currentStatus?: "up" | "degraded" | "down" | "paused" | "unknown" | null; }; /** @description Monitors that reference this secret; null on create/update responses */ MonitorReference: { @@ -5437,6 +5468,11 @@ export interface components { health: components["schemas"]["ResourceGroupHealthDto"]; /** @description Member list with individual statuses; populated on detail GET only */ members?: components["schemas"]["ResourceGroupMemberDto"][] | null; + /** + * @description Source that created/owns this group: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on groups created before this attribution column existed. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; /** * Format: date-time * @description Timestamp when the group was created @@ -5586,7 +5622,7 @@ export interface components { * @description Derived current status across all regions * @enum {string} */ - currentStatus: "up" | "degraded" | "down" | "unknown"; + currentStatus: "up" | "degraded" | "down" | "paused" | "unknown"; /** @description Latest check result per region */ latestPerRegion: components["schemas"]["RegionStatusDto"][]; /** @description Time-bucketed chart data for the requested window */ @@ -6453,6 +6489,11 @@ export interface components { subscriberCount?: number | null; /** @enum {string|null} */ overallStatus?: "OPERATIONAL" | "DEGRADED_PERFORMANCE" | "PARTIAL_OUTAGE" | "MAJOR_OUTAGE" | "UNDER_MAINTENANCE" | null; + /** + * @description Source that created/owns this status page: DASHBOARD, CLI, TERRAFORM, MCP, or API. Null on pages created before this attribution column existed. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; /** Format: date-time */ createdAt: string; /** Format: date-time */ @@ -7106,6 +7147,11 @@ export interface components { /** @description New channel name (full replacement, not partial update) */ name: string; config: components["schemas"]["DiscordChannelConfig"] | components["schemas"]["EmailChannelConfig"] | components["schemas"]["OpsGenieChannelConfig"] | components["schemas"]["PagerDutyChannelConfig"] | components["schemas"]["SlackChannelConfig"] | components["schemas"]["TeamsChannelConfig"] | components["schemas"]["WebhookChannelConfig"]; + /** + * @description New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; /** @description Request body for updating alert sensitivity on a service subscription */ UpdateAlertSensitivityRequest: { @@ -7144,7 +7190,7 @@ export interface components { UpdateMaintenanceWindowRequest: { /** * Format: uuid - * @description Monitor to attach this maintenance window to; null preserves current + * @description Monitor this window applies to; null switches the window to org-wide */ monitorId?: string | null; /** @@ -7157,11 +7203,11 @@ export interface components { * @description Updated end time (ISO 8601) */ endsAt: string; - /** @description Updated iCal RRULE; null clears the repeat rule */ + /** @description Reserved: iCal RRULE for recurring windows (stored but not yet honored); null clears it */ repeatRule?: string | null; - /** @description Updated reason; null clears the existing reason */ + /** @description Updated reason (max 500 chars); null clears the existing reason */ reason?: string | null; - /** @description Whether to suppress alerts; null preserves current */ + /** @description Whether to suppress alerts during this window; null defaults to true */ suppressAlerts?: boolean | null; }; UpdateMonitorAuthRequest: { @@ -7277,6 +7323,11 @@ export interface components { * @description Recovery cooldown in minutes; null clears */ recoveryCooldownMinutes?: number | null; + /** + * @description New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; UpdateSecretRequest: { /** @description New secret value, stored encrypted (max 32KB) */ @@ -7360,6 +7411,11 @@ export interface components { * @enum {string|null} */ incidentMode?: "MANUAL" | "REVIEW" | "AUTOMATIC" | null; + /** + * @description New attribution source: DASHBOARD, CLI, TERRAFORM, MCP, or API; null preserves current value. + * @enum {string|null} + */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API" | null; }; /** @description Request body for updating a tag; null fields are left unchanged */ UpdateTagRequest: { @@ -7575,6 +7631,12 @@ export interface operations { list_14: { parameters: { query: { + /** @description Filter by channel integration type (e.g. SLACK, WEBHOOK, EMAIL) */ + type?: "email" | "webhook" | "slack" | "pagerduty" | "opsgenie" | "teams" | "discord"; + /** @description Filter by managed-by source (DASHBOARD, CLI, TERRAFORM, MCP, API) */ + managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API"; + /** @description Case-insensitive contains-match on the channel name */ + search?: string; pageable: components["schemas"]["Pageable"]; }; header?: never; @@ -12785,14 +12847,18 @@ export interface operations { list_8: { parameters: { query: { - /** @description Filter by enabled state */ + /** @description Filter by enabled state (true/false) */ enabled?: boolean; + /** @description Lifecycle status alias: 'active' (enabled=true) or 'paused' (enabled=false). Ignored when ?enabled is also supplied. */ + status?: string; /** @description Filter by monitor type */ type?: "HTTP" | "DNS" | "MCP_SERVER" | "TCP" | "ICMP" | "HEARTBEAT"; /** @description Filter by managed-by source */ managedBy?: "DASHBOARD" | "CLI" | "TERRAFORM" | "MCP" | "API"; - /** @description Filter by tag names, comma-separated (e.g. prod,critical) */ + /** @description Filter by tag names, comma-separated (e.g. prod,critical); OR semantics */ tags?: string; + /** @description Filter by a single tag name (alias for ?tags=); merged with ?tags using OR semantics */ + tag?: string; /** @description Case-insensitive name search */ search?: string; /** @description Filter by environment ID */ diff --git a/test/negative-validation.test.ts b/test/negative-validation.test.ts index 9704c52..7af63ea 100644 --- a/test/negative-validation.test.ts +++ b/test/negative-validation.test.ts @@ -293,9 +293,13 @@ describe('CreateMonitorRequest negative validation', () => { it('rejects wrong config type (string)', () => fail(s, {...valid, config: 'https://example.com'})) it('rejects wrong config type (array)', () => fail(s, {...valid, config: []})) - it('rejects missing managedBy', () => { + // managedBy is optional on CreateMonitorRequest — the API defaults to "API" + // (or to the surface-injected value, e.g. "CLI") when the field is omitted. + // See mono#369 / sdk-python#26: switching from required to optional was a + // deliberate ergonomic fix so users don't have to set this on every request. + it('accepts missing managedBy (server defaults to API)', () => { const {managedBy: _, ...rest} = valid - fail(s, rest) + pass(s, rest) }) it('rejects invalid managedBy enum', () => fail(s, {...valid, managedBy: 'PULUMI'}))