1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

move models to api

This commit is contained in:
checktheroads
2020-02-01 08:44:33 -10:00
parent 0f749a5547
commit 0d91c79af9
9 changed files with 17 additions and 17 deletions

View File

@@ -19,6 +19,7 @@ from hyperglass.api.error_handlers import http_handler
from hyperglass.api.error_handlers import validation_handler
from hyperglass.api.events import on_shutdown
from hyperglass.api.events import on_startup
from hyperglass.api.models.response import QueryResponse
from hyperglass.api.routes import docs
from hyperglass.api.routes import queries
from hyperglass.api.routes import query
@@ -27,7 +28,6 @@ from hyperglass.configuration import URL_DEV
from hyperglass.configuration import params
from hyperglass.constants import __version__
from hyperglass.exceptions import HyperglassError
from hyperglass.models.response import QueryResponse
from hyperglass.util import log
STATIC_DIR = Path(__file__).parent.parent / "static"
@@ -117,7 +117,7 @@ app.add_api_route(
tags=[params.docs.group_title],
response_class=UJSONResponse,
)
app.add_api_route(path="api/docs", endpoint=docs, include_in_schema=False)
app.add_api_route(path="/api/docs", endpoint=docs, include_in_schema=False)
app.mount("/images", StaticFiles(directory=IMAGES_DIR), name="images")
app.mount("/", StaticFiles(directory=UI_DIR, html=True), name="ui")

View File

@@ -0,0 +1,10 @@
"""Query & Response Validation Models."""
# Project Imports
from hyperglass.api.models import query
from hyperglass.api.models import response
from hyperglass.api.models import rfc8522
from hyperglass.api.models import types
from hyperglass.api.models import validators
# flake8: noqa: F401

View File

@@ -9,14 +9,14 @@ from pydantic import StrictStr
from pydantic import validator
# Project Imports
from hyperglass.api.models.types import SupportedQuery
from hyperglass.api.models.validators import validate_aspath
from hyperglass.api.models.validators import validate_community
from hyperglass.api.models.validators import validate_ip
from hyperglass.configuration import devices
from hyperglass.configuration import params
from hyperglass.configuration.models.vrfs import Vrf
from hyperglass.exceptions import InputInvalid
from hyperglass.models.types import SupportedQuery
from hyperglass.models.validators import validate_aspath
from hyperglass.models.validators import validate_community
from hyperglass.models.validators import validate_ip
def get_vrf_object(vrf_name):

View File

@@ -11,12 +11,12 @@ from fastapi.openapi.docs import get_swagger_ui_html
from starlette.requests import Request
# Project Imports
from hyperglass.api.models.query import Query
from hyperglass.configuration import REDIS_CONFIG
from hyperglass.configuration import devices
from hyperglass.configuration import params
from hyperglass.exceptions import HyperglassError
from hyperglass.execution.execute import Execute
from hyperglass.models.query import Query
from hyperglass.util import log
Cache = aredis.StrictRedis(db=params.cache.database, **REDIS_CONFIG)

View File

@@ -1,10 +0,0 @@
"""Query & Response Validation Models."""
# Project Imports
# flake8: noqa: F401
from hyperglass.models import query
from hyperglass.models import response
from hyperglass.models import rfc8522
from hyperglass.models import types
from hyperglass.models import validators