mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
add outgoing http webhook for queries
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Input query validation model."""
|
||||
|
||||
# Standard Library
|
||||
import json
|
||||
import hashlib
|
||||
|
||||
# Third Party
|
||||
@@ -97,6 +98,19 @@ class Query(BaseModel):
|
||||
)
|
||||
return f'Query({", ".join(items)})'
|
||||
|
||||
def export_dict(self):
|
||||
"""Create dictionary representation of instance."""
|
||||
return {
|
||||
"query_location": self.query_location,
|
||||
"query_type": self.query_type,
|
||||
"query_vrf": self.query_vrf.name,
|
||||
"query_target": str(self.query_target),
|
||||
}
|
||||
|
||||
def export_json(self):
|
||||
"""Create JSON representation of instance."""
|
||||
return json.dumps(self.export_dict(), default=str)
|
||||
|
||||
@validator("query_type")
|
||||
def validate_query_type(cls, value):
|
||||
"""Ensure query_type is enabled.
|
||||
|
Reference in New Issue
Block a user