fix double RPKI status checking

This commit is contained in:
checktheroads 2020-07-13 02:17:56 -07:00
parent 6dd8cfc9ff
commit 10593de581

View file

@ -1,21 +1,24 @@
"""Response model."""
# Standard Library
from typing import List, Union, Optional
from typing import Dict, List, Union, Optional
# Third Party
from pydantic import BaseModel, StrictInt, StrictStr, StrictBool, constr
# Project
from hyperglass.configuration import params
from hyperglass.parsing.models.serialized import ParsedRoutes
ErrorName = constr(regex=r"(success|warning|error|danger)")
ResponseLevel = constr(regex=r"success")
ResponseFormat = constr(regex=r"(application\/json|text\/plain)")
class QueryError(BaseModel):
"""Query response model."""
output: StrictStr = params.messages.general
level: constr(regex=r"(success|warning|error|danger)") = "danger"
level: ErrorName = "danger"
id: Optional[StrictStr]
keywords: List[StrictStr] = []
@ -57,14 +60,14 @@ class QueryError(BaseModel):
class QueryResponse(BaseModel):
"""Query response model."""
output: Union[ParsedRoutes, StrictStr]
level: constr(regex=r"success") = "success"
output: Union[Dict, StrictStr]
level: ResponseLevel = "success"
random: StrictStr
cached: StrictBool
runtime: StrictInt
keywords: List[StrictStr] = []
timestamp: StrictStr
format: constr(regex=r"(application\/json|text\/plain)") = "text/plain"
format: ResponseFormat = "text/plain"
class Config:
"""Pydantic model configuration."""