1
0
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:
checktheroads
2020-04-15 02:12:01 -07:00
parent 5f3c516f86
commit b35040c0a2
11 changed files with 288 additions and 102 deletions

View File

@@ -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.