2021-09-11 11:17:38 -07:00
|
|
|
"""Input validation plugins."""
|
|
|
|
|
|
|
|
# Standard Library
|
2021-09-12 15:06:34 -07:00
|
|
|
from typing import TYPE_CHECKING, Union
|
2021-09-11 11:17:38 -07:00
|
|
|
|
|
|
|
# Local
|
2021-09-12 18:27:33 -07:00
|
|
|
from ._base import DirectivePlugin
|
2021-09-11 11:17:38 -07:00
|
|
|
|
2021-09-11 17:55:27 -07:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
# Project
|
|
|
|
from hyperglass.models.api.query import Query
|
|
|
|
|
2021-09-12 15:06:34 -07:00
|
|
|
InputPluginReturn = Union[None, bool]
|
|
|
|
|
2021-09-11 11:17:38 -07:00
|
|
|
|
2021-09-12 18:27:33 -07:00
|
|
|
class InputPlugin(DirectivePlugin):
|
2021-09-11 11:17:38 -07:00
|
|
|
"""Plugin to validate user input prior to running commands."""
|
|
|
|
|
2021-09-12 15:06:34 -07:00
|
|
|
def validate(self, query: "Query") -> InputPluginReturn:
|
2021-09-11 11:17:38 -07:00
|
|
|
"""Validate input from hyperglass UI/API."""
|
2021-09-12 15:06:34 -07:00
|
|
|
return None
|