ValidateAlarmCondition
Updated at:2025-11-03
Description
Verify whether the alarm conditions of the alarm policy are correct
Request
- Request syntax
Text
1POST /v1/alarm/condition/validate HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
5{
6 "conditions": [
7 "<Condition>"
8 ]
9}
- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| fieldTypes | List<List<Map<String, String>>> | Yes | RequestBody | Field names and types, in the order of SQL |
| conditions | List<String> | Yes | RequestBody | Execution condition list |
Among them, fieldTypes is a List<List<
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| code | String | Request code, OK for success, or a specific error code for failure |
| message | String | Empty for request success, or a specific error message for request failure |
| result | Result | Test result |
Result element results are as follows:
| Field | Types | Description |
|---|---|---|
| valid | Bool | Whether the verification is passed, true: Passed, false: Failed |
| message | String | If verification failed, return the failure reason |
Error code
No special error codes are returned beyond standard error codes.
Example
- Request example
Text
1POST /v1/alarm/condition/validate HTTP/1.1
2Host: bls-log.bj.baidubce.com
3Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
4Content-Type: application/json; charset=utf-8
5{
6 // Field names and types, in the order of SQL, required
7 "fieldTypes": [
8 // Logstore 1
9 [
10 // Execution statement 1
11 {
12 // Key is the field name in SQL, value is the type of the field
13 "cnt": "int"
14 },
15 // Execution statement 2
16 {
17 // key is the field name in SQL, and value is the field type
18 "cnt": "int"
19 }
20 ],
21 // Logstore 2
22 [
23 {
24 // key is the field name in SQL, and value is the field type
25 "cnt": "int"
26 },
27 {
28 // key is the field name in SQL, and value is the field type
29 "cnt": "int"
30 }
31 ]
32 ],
33
34 // List of execution conditions, required
35 "conditions": [
36 "$1.cnt + $2.cnt > 1"
37 ]
38}
- Response example
Text
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3X-Bce-Request-Id: 2eeba101-4cc7-4cfe-b5ac-a3be8d060e33
4Date: Fri, 10 Apr 2020 04:42:37 GMT
5{
6 "success": true,
7 "code": "OK", // Error code
8 "message": "", // Error details
9 "result": {
10 // Verification passed
11 "valid": true,
12 // If verification failed, the message will be provided
13 "message": "xxx"
14 }
15}
