This commit is contained in:
Stéphane Lesimple 2024-12-21 12:05:18 +00:00
parent 31dd4bf166
commit 0428f356b0
No known key found for this signature in database
GPG key ID: 4B4A3289E9D35658
4 changed files with 165 additions and 0 deletions

View 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?)$"
}
]
}

View 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"
]
}

View 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
}
}
}

View 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
}
}
}