ods-validator 0.1.0__py3-none-any.whl
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.
- ods_validator/__init__.py +3 -0
- ods_validator/__main__.py +48 -0
- ods_validator/_schemas/SessionStartedEvent.schema.json +61 -0
- ods_validator/_schemas/VERSION.json +5 -0
- ods_validator/_schemas/__init__.py +0 -0
- ods_validator/_schemas/actuatorStateEvent.schema.json +84 -0
- ods_validator/_schemas/alertActionCommand.schema.json +62 -0
- ods_validator/_schemas/alertActionReply.schema.json +88 -0
- ods_validator/_schemas/alertCommand.schema.json +60 -0
- ods_validator/_schemas/alertEvent.schema.json +105 -0
- ods_validator/_schemas/alertReply.schema.json +84 -0
- ods_validator/_schemas/alertsQuery.schema.json +49 -0
- ods_validator/_schemas/alertsReply.schema.json +164 -0
- ods_validator/_schemas/artifactPublishedEvent.schema.json +70 -0
- ods_validator/_schemas/audioChunkEvent.schema.json +64 -0
- ods_validator/_schemas/calibrationEvent.schema.json +122 -0
- ods_validator/_schemas/cameraQualityQuery.schema.json +31 -0
- ods_validator/_schemas/cameraQualityReply.schema.json +105 -0
- ods_validator/_schemas/captureCommand.schema.json +82 -0
- ods_validator/_schemas/captureReply.schema.json +84 -0
- ods_validator/_schemas/clipEvent.schema.json +88 -0
- ods_validator/_schemas/clipQuery.schema.json +44 -0
- ods_validator/_schemas/clipReply.schema.json +143 -0
- ods_validator/_schemas/codeReadEvent.schema.json +57 -0
- ods_validator/_schemas/detectionsEvent.schema.json +75 -0
- ods_validator/_schemas/entityEvent.schema.json +122 -0
- ods_validator/_schemas/eventMetricsEvent.schema.json +65 -0
- ods_validator/_schemas/facialMarkerEvent.schema.json +50 -0
- ods_validator/_schemas/frameEvent.schema.json +68 -0
- ods_validator/_schemas/heatmapQuery.schema.json +61 -0
- ods_validator/_schemas/heatmapReply.schema.json +140 -0
- ods_validator/_schemas/keypointsEvent.schema.json +115 -0
- ods_validator/_schemas/lexiconCaptureCommand.schema.json +45 -0
- ods_validator/_schemas/lexiconCaptureReply.schema.json +110 -0
- ods_validator/_schemas/metricsQuery.schema.json +58 -0
- ods_validator/_schemas/metricsReply.schema.json +186 -0
- ods_validator/_schemas/moveCommand.schema.json +45 -0
- ods_validator/_schemas/moveReply.schema.json +101 -0
- ods_validator/_schemas/pieceAnalysisEvent.schema.json +97 -0
- ods_validator/_schemas/plateReadEvent.schema.json +128 -0
- ods_validator/_schemas/positionEvent.schema.json +82 -0
- ods_validator/_schemas/ppeComplianceEvent.schema.json +100 -0
- ods_validator/_schemas/qualifiedEvent.schema.json +100 -0
- ods_validator/_schemas/recordCommand.schema.json +72 -0
- ods_validator/_schemas/recordReply.schema.json +96 -0
- ods_validator/_schemas/recordingsQuery.schema.json +39 -0
- ods_validator/_schemas/recordingsReply.schema.json +119 -0
- ods_validator/_schemas/replayCommand.schema.json +96 -0
- ods_validator/_schemas/replayReply.schema.json +109 -0
- ods_validator/_schemas/replayStateEvent.schema.json +54 -0
- ods_validator/_schemas/rulesCommand.schema.json +83 -0
- ods_validator/_schemas/rulesReply.schema.json +86 -0
- ods_validator/_schemas/signEvent.schema.json +71 -0
- ods_validator/_schemas/synthesisCommand.schema.json +61 -0
- ods_validator/_schemas/synthesisReply.schema.json +153 -0
- ods_validator/_schemas/tracksEvent.schema.json +93 -0
- ods_validator/_schemas/transcriptEvent.schema.json +96 -0
- ods_validator/_schemas/zoneMetricsEvent.schema.json +71 -0
- ods_validator/_schemas/zoneOccupancyEvent.schema.json +62 -0
- ods_validator/_schemas/zoneTransitionEvent.schema.json +74 -0
- ods_validator/validator.py +112 -0
- ods_validator-0.1.0.dist-info/METADATA +109 -0
- ods_validator-0.1.0.dist-info/RECORD +67 -0
- ods_validator-0.1.0.dist-info/WHEEL +5 -0
- ods_validator-0.1.0.dist-info/entry_points.txt +2 -0
- ods_validator-0.1.0.dist-info/licenses/LICENSE +21 -0
- ods_validator-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from . import Validator
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main(argv=None) -> int:
|
|
9
|
+
parser = argparse.ArgumentParser(prog="ods-validate")
|
|
10
|
+
parser.add_argument("--schemas", help="pasta dos schemas (ou ODS_SCHEMAS_DIR)")
|
|
11
|
+
parser.add_argument("--topic", help="força o tópico (padrão: campo 'schema')")
|
|
12
|
+
parser.add_argument("--info", action="store_true", help="mostra de onde vêm os schemas")
|
|
13
|
+
parser.add_argument("files", nargs="*", help="arquivos JSON (- para stdin)")
|
|
14
|
+
args = parser.parse_args(argv)
|
|
15
|
+
validator = Validator(args.schemas)
|
|
16
|
+
if args.info:
|
|
17
|
+
for key, value in validator.schemas_version.items():
|
|
18
|
+
print(f"{key}: {value}")
|
|
19
|
+
if not args.files:
|
|
20
|
+
return 0
|
|
21
|
+
if not args.files:
|
|
22
|
+
parser.error("informe ao menos um arquivo (ou use --info)")
|
|
23
|
+
status = 0
|
|
24
|
+
for name in args.files:
|
|
25
|
+
text = sys.stdin.read() if name == "-" else open(name, encoding="utf-8").read()
|
|
26
|
+
try:
|
|
27
|
+
message = json.loads(text)
|
|
28
|
+
except json.JSONDecodeError as e:
|
|
29
|
+
print(f"{name}: JSON inválido ({e})")
|
|
30
|
+
status = 1
|
|
31
|
+
continue
|
|
32
|
+
errors = (
|
|
33
|
+
validator.find_errors(args.topic, message)
|
|
34
|
+
if args.topic
|
|
35
|
+
else validator.find_message_errors(message)
|
|
36
|
+
)
|
|
37
|
+
if errors:
|
|
38
|
+
status = 1
|
|
39
|
+
print(f"{name}: INVÁLIDA")
|
|
40
|
+
for e in errors:
|
|
41
|
+
print(" -", e)
|
|
42
|
+
else:
|
|
43
|
+
print(f"{name}: ok")
|
|
44
|
+
return status
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
sys.exit(main())
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "SessionStartedEvent",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.session.started"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "event"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"payload": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"mode": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": ["REPLAY", "LIVE"]
|
|
23
|
+
},
|
|
24
|
+
"started_at": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"format": "date-time"
|
|
27
|
+
},
|
|
28
|
+
"sources": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"recording_id": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"previous_session_id": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"format": "uuid"
|
|
40
|
+
},
|
|
41
|
+
"reason": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["SEEK", "START", "RESTART", "LOOP", "RECONNECT"]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"mode",
|
|
48
|
+
"started_at",
|
|
49
|
+
"sources"
|
|
50
|
+
],
|
|
51
|
+
"additionalProperties": false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"required": [
|
|
55
|
+
"schema",
|
|
56
|
+
"message_type",
|
|
57
|
+
"producer",
|
|
58
|
+
"payload"
|
|
59
|
+
],
|
|
60
|
+
"additionalProperties": false
|
|
61
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ActuatorStateEvent",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.p7.state"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "event"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"source_id": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"payload": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"pan_deg": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"tilt_deg": {
|
|
27
|
+
"type": "number"
|
|
28
|
+
},
|
|
29
|
+
"state": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"enum": ["IDLE", "MOVING", "HOMING", "ERROR"]
|
|
32
|
+
},
|
|
33
|
+
"is_homed": {
|
|
34
|
+
"type": "boolean"
|
|
35
|
+
},
|
|
36
|
+
"last_command_id": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"format": "uuid"
|
|
39
|
+
},
|
|
40
|
+
"error": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"code": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": [
|
|
46
|
+
"OUT_OF_RANGE",
|
|
47
|
+
"NOT_HOMED",
|
|
48
|
+
"LIMIT_SWITCH_REACHED",
|
|
49
|
+
"DEVICE_ERROR"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"message": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": ["code", "message"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": ["pan_deg", "tilt_deg", "state", "is_homed"],
|
|
60
|
+
"allOf": [
|
|
61
|
+
{
|
|
62
|
+
"if": {
|
|
63
|
+
"properties": {
|
|
64
|
+
"state": {
|
|
65
|
+
"const": "ERROR"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"required": ["state"]
|
|
69
|
+
},
|
|
70
|
+
"then": {
|
|
71
|
+
"required": ["error"]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"required": [
|
|
78
|
+
"schema",
|
|
79
|
+
"message_type",
|
|
80
|
+
"producer",
|
|
81
|
+
"source_id",
|
|
82
|
+
"payload"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertActionCommand",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alert_action.command"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "command"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"target": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"payload": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"alert_id": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "uuid"
|
|
26
|
+
},
|
|
27
|
+
"action": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["ACKNOWLEDGE", "MUTE", "CLOSE"]
|
|
30
|
+
},
|
|
31
|
+
"actor": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^user:.+$"
|
|
34
|
+
},
|
|
35
|
+
"mute_until": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"format": "date-time"
|
|
38
|
+
},
|
|
39
|
+
"reason": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["alert_id", "action", "actor"],
|
|
44
|
+
"allOf": [
|
|
45
|
+
{
|
|
46
|
+
"if": {
|
|
47
|
+
"properties": {
|
|
48
|
+
"action": {
|
|
49
|
+
"const": "MUTE"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": ["action"]
|
|
53
|
+
},
|
|
54
|
+
"then": {
|
|
55
|
+
"required": ["mute_until"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": ["schema", "message_type", "producer", "target", "payload"]
|
|
62
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertActionReply",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alert_action.reply"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "reply"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"correlation_id": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "uuid"
|
|
20
|
+
},
|
|
21
|
+
"payload": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"status": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["OK", "ERROR"]
|
|
27
|
+
},
|
|
28
|
+
"alert_id": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"format": "uuid"
|
|
31
|
+
},
|
|
32
|
+
"state": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
|
|
35
|
+
},
|
|
36
|
+
"error": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"code": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": ["ALERT_NOT_FOUND", "INVALID_TRANSITION"]
|
|
42
|
+
},
|
|
43
|
+
"message": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": ["code", "message"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": ["status"],
|
|
51
|
+
"allOf": [
|
|
52
|
+
{
|
|
53
|
+
"if": {
|
|
54
|
+
"properties": {
|
|
55
|
+
"status": {
|
|
56
|
+
"const": "OK"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": ["status"]
|
|
60
|
+
},
|
|
61
|
+
"then": {
|
|
62
|
+
"required": ["alert_id", "state"]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"if": {
|
|
67
|
+
"properties": {
|
|
68
|
+
"status": {
|
|
69
|
+
"const": "ERROR"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"required": ["status"]
|
|
73
|
+
},
|
|
74
|
+
"then": {
|
|
75
|
+
"required": ["error"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": [
|
|
82
|
+
"schema",
|
|
83
|
+
"message_type",
|
|
84
|
+
"producer",
|
|
85
|
+
"correlation_id",
|
|
86
|
+
"payload"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertCommand",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alert.command"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "command"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"target": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"payload": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"event_id": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "uuid"
|
|
26
|
+
},
|
|
27
|
+
"title": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"message": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"severity": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["HIGH", "MEDIUM", "LOW"]
|
|
36
|
+
},
|
|
37
|
+
"recipients": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"pattern": "^(user|group|role):.+$"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"channels": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"enum": ["SOUND", "SCREEN", "PUSH"]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"clip_id": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"format": "uuid"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": ["title", "message", "severity", "recipients", "channels"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": ["schema", "message_type", "producer", "target", "payload"]
|
|
60
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertEvent",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alert"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "event"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"artifact_version": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"payload": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"alert_id": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "uuid"
|
|
26
|
+
},
|
|
27
|
+
"event_id": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"format": "uuid"
|
|
30
|
+
},
|
|
31
|
+
"title": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"message": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"severity": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["HIGH", "MEDIUM", "LOW"]
|
|
40
|
+
},
|
|
41
|
+
"recipients": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"pattern": "^(user|group|role):.+$"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"channels": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"enum": ["SOUND", "SCREEN", "PUSH"]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"clip_id": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"format": "uuid"
|
|
58
|
+
},
|
|
59
|
+
"state": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
|
|
62
|
+
},
|
|
63
|
+
"created_at": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"format": "date-time"
|
|
66
|
+
},
|
|
67
|
+
"acknowledged_by": {
|
|
68
|
+
"type": "string"
|
|
69
|
+
},
|
|
70
|
+
"acknowledged_at": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"format": "date-time"
|
|
73
|
+
},
|
|
74
|
+
"muted_until": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"format": "date-time"
|
|
77
|
+
},
|
|
78
|
+
"closed_by": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"closed_at": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"format": "date-time"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": [
|
|
87
|
+
"alert_id",
|
|
88
|
+
"title",
|
|
89
|
+
"message",
|
|
90
|
+
"severity",
|
|
91
|
+
"recipients",
|
|
92
|
+
"channels",
|
|
93
|
+
"state",
|
|
94
|
+
"created_at"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"required": [
|
|
99
|
+
"schema",
|
|
100
|
+
"message_type",
|
|
101
|
+
"producer",
|
|
102
|
+
"artifact_version",
|
|
103
|
+
"payload"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertReply",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alert.reply"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "reply"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"correlation_id": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "uuid"
|
|
20
|
+
},
|
|
21
|
+
"payload": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"status": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["OK", "ERROR"]
|
|
27
|
+
},
|
|
28
|
+
"alert_id": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"format": "uuid"
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"code": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": ["INVALID_RECIPIENT", "INVALID_CHANNEL"]
|
|
38
|
+
},
|
|
39
|
+
"message": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["code", "message"]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["status"],
|
|
47
|
+
"allOf": [
|
|
48
|
+
{
|
|
49
|
+
"if": {
|
|
50
|
+
"properties": {
|
|
51
|
+
"status": {
|
|
52
|
+
"const": "OK"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": ["status"]
|
|
56
|
+
},
|
|
57
|
+
"then": {
|
|
58
|
+
"required": ["alert_id"]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"if": {
|
|
63
|
+
"properties": {
|
|
64
|
+
"status": {
|
|
65
|
+
"const": "ERROR"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"required": ["status"]
|
|
69
|
+
},
|
|
70
|
+
"then": {
|
|
71
|
+
"required": ["error"]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"required": [
|
|
78
|
+
"schema",
|
|
79
|
+
"message_type",
|
|
80
|
+
"producer",
|
|
81
|
+
"correlation_id",
|
|
82
|
+
"payload"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "AlertsQuery",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "ods.s3.alerts.query"
|
|
9
|
+
},
|
|
10
|
+
"message_type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "query"
|
|
13
|
+
},
|
|
14
|
+
"producer": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"target": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"payload": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"from_at": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "date-time"
|
|
26
|
+
},
|
|
27
|
+
"to_at": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"format": "date-time"
|
|
30
|
+
},
|
|
31
|
+
"state": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
|
|
34
|
+
},
|
|
35
|
+
"severity": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": ["HIGH", "MEDIUM", "LOW"]
|
|
38
|
+
},
|
|
39
|
+
"limit": {
|
|
40
|
+
"type": "integer",
|
|
41
|
+
"minimum": 1,
|
|
42
|
+
"maximum": 500
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"required": ["schema", "message_type", "producer", "target", "payload"]
|
|
49
|
+
}
|