mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-12 07:54:36 +08:00
wip
This commit is contained in:
parent
31dd4bf166
commit
0428f356b0
4 changed files with 165 additions and 0 deletions
21
json-schema/include/ip-or-netblock.jsonschema
Normal file
21
json-schema/include/ip-or-netblock.jsonschema
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ovh.github.io/the-bastion/schemas/plugins-include/ip-or-netblock",
|
||||
"type": "string",
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "ipv4"
|
||||
},
|
||||
{
|
||||
"format": "ipv6"
|
||||
},
|
||||
{
|
||||
"$comment": "IPv4 netblock",
|
||||
"pattern": "^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}/(\\d|[12]\\d|3[012])$"
|
||||
},
|
||||
{
|
||||
"$comment": "IPv6 validation through regexes is extremely cumbersome, so just validate that it does roughly look like an IPv6 netblock",
|
||||
"pattern": "^[a-fA-F0-9:]+/(12[0-8]|1[01]\\d|\\d\\d?)$"
|
||||
}
|
||||
]
|
||||
}
|
81
json-schema/include/result.jsonschema
Normal file
81
json-schema/include/result.jsonschema
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ovh.github.io/the-bastion/schemas/plugins-include/result",
|
||||
"$defs": {
|
||||
"command": {
|
||||
"description": "Command name",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-zA-Z]+$",
|
||||
"minLength": 2
|
||||
},
|
||||
"error_message": {
|
||||
"type": "string",
|
||||
"minLength": 2
|
||||
},
|
||||
"session_id": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-f0-9]{12}$"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"minProperties": 5,
|
||||
"maxProperties": 5,
|
||||
"oneOf": [
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"command": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/command"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error_message": {
|
||||
"$ref": "#/$defs/error_message"
|
||||
},
|
||||
"error_code": {
|
||||
"type": "string",
|
||||
"pattern": "^(ERR|KO)(_[A-Z_]+)?$"
|
||||
},
|
||||
"value": {
|
||||
"type": ["array","object","null"]
|
||||
},
|
||||
"session_id": {
|
||||
"$ref": "#/$defs/session_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"command": {
|
||||
"$ref": "#/$defs/command"
|
||||
},
|
||||
"error_message": {
|
||||
"$ref": "#/$defs/error_message"
|
||||
},
|
||||
"error_code": {
|
||||
"type": "string",
|
||||
"pattern": "^OK(_[A-Z_]+)?$"
|
||||
},
|
||||
"value": {
|
||||
"type": ["array","object","null"]
|
||||
},
|
||||
"session_id": {
|
||||
"$ref": "#/$defs/session_id"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"required": [
|
||||
"command",
|
||||
"error_code",
|
||||
"error_message",
|
||||
"value"
|
||||
]
|
||||
}
|
12
json-schema/plugins/alive.jsonschema
Normal file
12
json-schema/plugins/alive.jsonschema
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ovh.github.io/the-bastion/schemas/plugins/alive",
|
||||
"type": "object",
|
||||
"allowAdditionalProperties": false,
|
||||
"properties": {
|
||||
"waited_for": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
}
|
51
json-schema/plugins/ping.jsonschema
Normal file
51
json-schema/plugins/ping.jsonschema
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ovh.github.io/the-bastion/schemas/plugins/ping",
|
||||
"type": "object",
|
||||
"allowAdditionalProperties": false,
|
||||
"required":["sysret","host"],
|
||||
"properties": {
|
||||
"max": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"sysret": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"packets_received": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"host": {
|
||||
"type": "string",
|
||||
"format": "hostname"
|
||||
},
|
||||
"packets_loss_percentage": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100
|
||||
},
|
||||
"min": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"ping_duration": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"mdev": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"packets_transmitted": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"avg": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue