|
4558 | 4558 | }, |
4559 | 4559 | "required": ["event_type", "action"] |
4560 | 4560 | }, |
| 4561 | + { |
| 4562 | + "$ref": "#/components/schemas/WindowedAutomationConfig" |
| 4563 | + }, |
4561 | 4564 | { |
4562 | 4565 | "$ref": "#/components/schemas/TopicAutomationConfig" |
4563 | 4566 | }, |
|
7090 | 7093 | } |
7091 | 7094 | ], |
7092 | 7095 | "description": "Options for the view in the app" |
| 7096 | + }, |
| 7097 | + "WindowedAutomationConfig": { |
| 7098 | + "type": "object", |
| 7099 | + "properties": { |
| 7100 | + "event_type": { |
| 7101 | + "type": "string", |
| 7102 | + "enum": ["windowed"], |
| 7103 | + "description": "The type of automation." |
| 7104 | + }, |
| 7105 | + "status": { |
| 7106 | + "$ref": "#/components/schemas/AutomationStatus" |
| 7107 | + }, |
| 7108 | + "threshold": { |
| 7109 | + "type": "object", |
| 7110 | + "properties": { |
| 7111 | + "calculation": { |
| 7112 | + "oneOf": [ |
| 7113 | + { |
| 7114 | + "type": "object", |
| 7115 | + "properties": { |
| 7116 | + "type": { |
| 7117 | + "type": "string", |
| 7118 | + "enum": ["btql"] |
| 7119 | + }, |
| 7120 | + "btql_query": { |
| 7121 | + "type": "string", |
| 7122 | + "minLength": 1, |
| 7123 | + "description": "A project-scoped BTQL or SQL query without runtime-owned evaluation time bounds" |
| 7124 | + }, |
| 7125 | + "output": { |
| 7126 | + "type": "object", |
| 7127 | + "properties": { |
| 7128 | + "type": { |
| 7129 | + "type": "string", |
| 7130 | + "enum": ["scalar"] |
| 7131 | + }, |
| 7132 | + "value_column": { |
| 7133 | + "type": "string", |
| 7134 | + "minLength": 1, |
| 7135 | + "description": "The numeric result column produced by the query" |
| 7136 | + } |
| 7137 | + }, |
| 7138 | + "required": ["type", "value_column"] |
| 7139 | + } |
| 7140 | + }, |
| 7141 | + "required": ["type", "btql_query", "output"] |
| 7142 | + } |
| 7143 | + ], |
| 7144 | + "description": "The calculation evaluated for each window" |
| 7145 | + }, |
| 7146 | + "policy": { |
| 7147 | + "type": "object", |
| 7148 | + "properties": { |
| 7149 | + "condition": { |
| 7150 | + "type": "object", |
| 7151 | + "properties": { |
| 7152 | + "type": { |
| 7153 | + "type": "string", |
| 7154 | + "enum": ["threshold"] |
| 7155 | + }, |
| 7156 | + "operator": { |
| 7157 | + "type": "string", |
| 7158 | + "enum": ["lt", "lte", "gt", "gte", "eq", "neq"] |
| 7159 | + }, |
| 7160 | + "threshold": { |
| 7161 | + "type": "number" |
| 7162 | + } |
| 7163 | + }, |
| 7164 | + "required": ["type", "operator", "threshold"] |
| 7165 | + }, |
| 7166 | + "pending_seconds": { |
| 7167 | + "type": "integer", |
| 7168 | + "minimum": 0, |
| 7169 | + "maximum": 2592000, |
| 7170 | + "description": "How long the condition must remain breached before firing" |
| 7171 | + }, |
| 7172 | + "no_data_behavior": { |
| 7173 | + "type": "string", |
| 7174 | + "enum": ["keep_last", "resolve", "alert"], |
| 7175 | + "description": "How the lifecycle changes when the calculation returns no data" |
| 7176 | + }, |
| 7177 | + "renotify_interval_seconds": { |
| 7178 | + "type": ["integer", "null"], |
| 7179 | + "minimum": 1, |
| 7180 | + "maximum": 2592000, |
| 7181 | + "description": "Optional reminder interval while the automation is firing" |
| 7182 | + }, |
| 7183 | + "notify_on_recovery": { |
| 7184 | + "type": "boolean", |
| 7185 | + "default": true, |
| 7186 | + "description": "Whether to deliver actions when a firing automation recovers" |
| 7187 | + } |
| 7188 | + }, |
| 7189 | + "required": [ |
| 7190 | + "condition", |
| 7191 | + "pending_seconds", |
| 7192 | + "no_data_behavior" |
| 7193 | + ], |
| 7194 | + "description": "The lifecycle policy applied to each calculation result" |
| 7195 | + } |
| 7196 | + }, |
| 7197 | + "required": ["calculation", "policy"], |
| 7198 | + "description": "Optional calculation and lifecycle policy that gate scheduled delivery" |
| 7199 | + }, |
| 7200 | + "window": { |
| 7201 | + "type": "object", |
| 7202 | + "properties": { |
| 7203 | + "window_seconds": { |
| 7204 | + "type": "integer", |
| 7205 | + "minimum": 1, |
| 7206 | + "maximum": 2592000, |
| 7207 | + "description": "How much recent data each scheduled run covers" |
| 7208 | + }, |
| 7209 | + "schedule": { |
| 7210 | + "oneOf": [ |
| 7211 | + { |
| 7212 | + "type": "object", |
| 7213 | + "properties": { |
| 7214 | + "type": { |
| 7215 | + "type": "string", |
| 7216 | + "enum": ["interval"] |
| 7217 | + }, |
| 7218 | + "evaluation_interval_seconds": { |
| 7219 | + "type": "integer", |
| 7220 | + "minimum": 1, |
| 7221 | + "maximum": 2592000, |
| 7222 | + "description": "How often the automation runs" |
| 7223 | + } |
| 7224 | + }, |
| 7225 | + "required": ["type", "evaluation_interval_seconds"] |
| 7226 | + }, |
| 7227 | + { |
| 7228 | + "type": "object", |
| 7229 | + "properties": { |
| 7230 | + "type": { |
| 7231 | + "type": "string", |
| 7232 | + "enum": ["cron"] |
| 7233 | + }, |
| 7234 | + "cron_expression": { |
| 7235 | + "type": "string", |
| 7236 | + "minLength": 1, |
| 7237 | + "description": "A standard five-field cron expression (minute hour day-of-month month day-of-week) controlling when the automation runs" |
| 7238 | + }, |
| 7239 | + "timezone": { |
| 7240 | + "type": ["string", "null"], |
| 7241 | + "minLength": 1, |
| 7242 | + "description": "IANA timezone used to interpret the cron expression (defaults to UTC)" |
| 7243 | + } |
| 7244 | + }, |
| 7245 | + "required": ["type", "cron_expression"] |
| 7246 | + } |
| 7247 | + ], |
| 7248 | + "description": "How often the windowed automation runs: at a fixed interval or on a cron schedule" |
| 7249 | + }, |
| 7250 | + "evaluation_delay_seconds": { |
| 7251 | + "type": "integer", |
| 7252 | + "minimum": 0, |
| 7253 | + "maximum": 2592000, |
| 7254 | + "description": "How far behind the present each evaluation window ends" |
| 7255 | + } |
| 7256 | + }, |
| 7257 | + "required": [ |
| 7258 | + "window_seconds", |
| 7259 | + "schedule", |
| 7260 | + "evaluation_delay_seconds" |
| 7261 | + ] |
| 7262 | + }, |
| 7263 | + "actions": { |
| 7264 | + "type": "array", |
| 7265 | + "items": { |
| 7266 | + "oneOf": [ |
| 7267 | + { |
| 7268 | + "type": "object", |
| 7269 | + "properties": { |
| 7270 | + "type": { |
| 7271 | + "type": "string", |
| 7272 | + "enum": ["webhook"], |
| 7273 | + "description": "The type of action to take" |
| 7274 | + }, |
| 7275 | + "url": { |
| 7276 | + "type": "string", |
| 7277 | + "description": "The webhook URL to send the request to" |
| 7278 | + } |
| 7279 | + }, |
| 7280 | + "required": ["type", "url"] |
| 7281 | + }, |
| 7282 | + { |
| 7283 | + "type": "object", |
| 7284 | + "properties": { |
| 7285 | + "type": { |
| 7286 | + "type": "string", |
| 7287 | + "enum": ["slack"], |
| 7288 | + "description": "The type of action to take" |
| 7289 | + }, |
| 7290 | + "workspace_id": { |
| 7291 | + "type": "string", |
| 7292 | + "description": "The Slack workspace ID to post to" |
| 7293 | + }, |
| 7294 | + "channel": { |
| 7295 | + "type": "string", |
| 7296 | + "description": "The Slack channel ID to post to" |
| 7297 | + }, |
| 7298 | + "message_template": { |
| 7299 | + "type": "string", |
| 7300 | + "description": "Custom message template for the alert" |
| 7301 | + } |
| 7302 | + }, |
| 7303 | + "required": ["type", "workspace_id", "channel"] |
| 7304 | + } |
| 7305 | + ], |
| 7306 | + "description": "A delivery action available to an automation" |
| 7307 | + }, |
| 7308 | + "minItems": 1, |
| 7309 | + "maxItems": 20, |
| 7310 | + "description": "The delivery actions to run on each schedule or threshold lifecycle transition" |
| 7311 | + } |
| 7312 | + }, |
| 7313 | + "required": ["event_type", "window", "actions"] |
7093 | 7314 | } |
7094 | 7315 | }, |
7095 | 7316 | "parameters": {} |
|
0 commit comments