mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
24 lines
525 B
Python
24 lines
525 B
Python
"""Input validation plugins."""
|
|
|
|
# Standard Library
|
|
import typing as t
|
|
|
|
# Local
|
|
from ._base import DirectivePlugin
|
|
|
|
if t.TYPE_CHECKING:
|
|
# Project
|
|
from hyperglass.models.api.query import Query
|
|
|
|
InputPluginReturn = t.Union[None, bool]
|
|
|
|
|
|
class InputPlugin(DirectivePlugin):
|
|
"""Plugin to validate user input prior to running commands."""
|
|
|
|
failure_reason: t.Optional[str] = None
|
|
|
|
def validate(self, query: "Query") -> InputPluginReturn:
|
|
"""Validate input from hyperglass UI/API."""
|
|
return None
|