From 278214ff8e3ab1a9e4a2fd5e8717ddfd430cf57c Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 6 Aug 2019 16:08:10 -0700 Subject: [PATCH] Add /api/v1/ handler with no routes --- src/pylorax/api/server.py | 8 ++++++-- src/pylorax/api/v1.py | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/pylorax/api/v1.py diff --git a/src/pylorax/api/server.py b/src/pylorax/api/server.py index 6078be40..1b536350 100644 --- a/src/pylorax/api/server.py +++ b/src/pylorax/api/server.py @@ -26,6 +26,7 @@ import werkzeug from pylorax import vernum from pylorax.api.errors import HTTP_ERROR from pylorax.api.v0 import v0_api +from pylorax.api.v1 import v1_api from pylorax.sysutils import joinpaths GitLock = namedtuple("GitLock", ["repo", "lock", "dir"]) @@ -53,9 +54,9 @@ def api_docs(path=None): return send_from_directory(docs_path, path) @server.route("/api/status") -def v0_status(): +def api_status(): """ - `/api/v0/status` + `/api/status` ^^^^^^^^^^^^^^^^ Return the status of the API Server:: @@ -85,3 +86,6 @@ def bad_request(error): # Register the v0 API on /api/v0/ server.register_blueprint(v0_api, url_prefix="/api/v0/") + +# Register the v1 API on /api/v1/ +server.register_blueprint(v1_api, url_prefix="/api/v1/") diff --git a/src/pylorax/api/v1.py b/src/pylorax/api/v1.py new file mode 100644 index 00000000..0d0a50ab --- /dev/null +++ b/src/pylorax/api/v1.py @@ -0,0 +1,23 @@ +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +""" Setup v1 of the API server + +""" +from pylorax.api.flask_blueprint import BlueprintSkip + +# Create the v1 routes Blueprint with skip_routes support +v1_api = BlueprintSkip("v1_routes", __name__)