From fb48b07011c6bccb051b2f34cb36e29afe498800 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Thu, 11 Dec 2014 01:59:09 -0300 Subject: [PATCH] Slighty refactoring for the cross api spec An API package has been created in common to store the API base class, request and response classes, API validation and schemas. The processing of the requests and responses will be added in a follow up patch. Change-Id: I3068b6fffde2d4d88a6009ca2ed703b38b791273 Partial-Implements: blueprint cross-transport-api-spec --- doc/source/api/autoindex.rst | 10 +++++----- ...qar.common.request.rst => zaqar.common.api.api.rst} | 4 ++-- doc/source/api/zaqar.common.api.request.rst | 7 +++++++ doc/source/api/zaqar.common.api.response.rst | 7 +++++++ doc/source/api/zaqar.common.api.rst | 7 ------- doc/source/api/zaqar.common.api.schemas.flavors.rst | 7 +++++++ doc/source/api/zaqar.common.api.schemas.pools.rst | 7 +++++++ doc/source/api/zaqar.common.response.rst | 7 ------- doc/source/api/zaqar.common.schemas.flavors.rst | 7 ------- doc/source/api/zaqar.common.schemas.pools.rst | 7 ------- tests/unit/common/test_api.py | 2 +- tests/unit/common/test_request.py | 2 +- zaqar/api/v1/request.py | 2 +- zaqar/api/v1/response.py | 2 +- zaqar/api/v1_1/request.py | 2 +- zaqar/api/v1_1/response.py | 2 +- zaqar/common/{schemas => api}/__init__.py | 0 zaqar/common/{ => api}/api.py | 0 zaqar/common/{ => api}/request.py | 0 zaqar/common/{ => api}/response.py | 0 zaqar/common/api/schemas/__init__.py | 0 zaqar/common/{ => api}/schemas/flavors.py | 0 zaqar/common/{ => api}/schemas/pools.py | 0 zaqar/transport/wsgi/v1_0/pools.py | 2 +- zaqar/transport/wsgi/v1_1/flavors.py | 2 +- zaqar/transport/wsgi/v1_1/pools.py | 2 +- 26 files changed, 44 insertions(+), 44 deletions(-) rename doc/source/api/{zaqar.common.request.rst => zaqar.common.api.api.rst} (54%) create mode 100644 doc/source/api/zaqar.common.api.request.rst create mode 100644 doc/source/api/zaqar.common.api.response.rst delete mode 100644 doc/source/api/zaqar.common.api.rst create mode 100644 doc/source/api/zaqar.common.api.schemas.flavors.rst create mode 100644 doc/source/api/zaqar.common.api.schemas.pools.rst delete mode 100644 doc/source/api/zaqar.common.response.rst delete mode 100644 doc/source/api/zaqar.common.schemas.flavors.rst delete mode 100644 doc/source/api/zaqar.common.schemas.pools.rst rename zaqar/common/{schemas => api}/__init__.py (100%) rename zaqar/common/{ => api}/api.py (100%) rename zaqar/common/{ => api}/request.py (100%) rename zaqar/common/{ => api}/response.py (100%) create mode 100644 zaqar/common/api/schemas/__init__.py rename zaqar/common/{ => api}/schemas/flavors.py (100%) rename zaqar/common/{ => api}/schemas/pools.py (100%) diff --git a/doc/source/api/autoindex.rst b/doc/source/api/autoindex.rst index 6632308bf..dd7778e3d 100644 --- a/doc/source/api/autoindex.rst +++ b/doc/source/api/autoindex.rst @@ -9,15 +9,15 @@ zaqar.cmd.gc.rst zaqar.cmd.server.rst zaqar.common.access.rst - zaqar.common.api.rst + zaqar.common.api.api.rst + zaqar.common.api.request.rst + zaqar.common.api.response.rst + zaqar.common.api.schemas.flavors.rst + zaqar.common.api.schemas.pools.rst zaqar.common.cli.rst zaqar.common.decorators.rst zaqar.common.errors.rst zaqar.common.pipeline.rst - zaqar.common.request.rst - zaqar.common.response.rst - zaqar.common.schemas.flavors.rst - zaqar.common.schemas.pools.rst zaqar.common.storage.select.rst zaqar.common.transport.wsgi.helpers.rst zaqar.common.utils.rst diff --git a/doc/source/api/zaqar.common.request.rst b/doc/source/api/zaqar.common.api.api.rst similarity index 54% rename from doc/source/api/zaqar.common.request.rst rename to doc/source/api/zaqar.common.api.api.rst index 2604c6c4b..6fc913da0 100644 --- a/doc/source/api/zaqar.common.request.rst +++ b/doc/source/api/zaqar.common.api.api.rst @@ -1,7 +1,7 @@ -The :mod:`zaqar.common.request` module +The :mod:`zaqar.common.api.api` module ======================================= -.. automodule:: zaqar.common.request +.. automodule:: zaqar.common.api.api :members: :undoc-members: :show-inheritance: diff --git a/doc/source/api/zaqar.common.api.request.rst b/doc/source/api/zaqar.common.api.request.rst new file mode 100644 index 000000000..b371ed95a --- /dev/null +++ b/doc/source/api/zaqar.common.api.request.rst @@ -0,0 +1,7 @@ +The :mod:`zaqar.common.api.request` module +=========================================== + +.. automodule:: zaqar.common.api.request + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/zaqar.common.api.response.rst b/doc/source/api/zaqar.common.api.response.rst new file mode 100644 index 000000000..383563d3c --- /dev/null +++ b/doc/source/api/zaqar.common.api.response.rst @@ -0,0 +1,7 @@ +The :mod:`zaqar.common.api.response` module +============================================ + +.. automodule:: zaqar.common.api.response + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/zaqar.common.api.rst b/doc/source/api/zaqar.common.api.rst deleted file mode 100644 index d37a79d57..000000000 --- a/doc/source/api/zaqar.common.api.rst +++ /dev/null @@ -1,7 +0,0 @@ -The :mod:`zaqar.common.api` module -=================================== - -.. automodule:: zaqar.common.api - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/zaqar.common.api.schemas.flavors.rst b/doc/source/api/zaqar.common.api.schemas.flavors.rst new file mode 100644 index 000000000..a269ae58b --- /dev/null +++ b/doc/source/api/zaqar.common.api.schemas.flavors.rst @@ -0,0 +1,7 @@ +The :mod:`zaqar.common.api.schemas.flavors` module +=================================================== + +.. automodule:: zaqar.common.api.schemas.flavors + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/zaqar.common.api.schemas.pools.rst b/doc/source/api/zaqar.common.api.schemas.pools.rst new file mode 100644 index 000000000..2dc5947dd --- /dev/null +++ b/doc/source/api/zaqar.common.api.schemas.pools.rst @@ -0,0 +1,7 @@ +The :mod:`zaqar.common.api.schemas.pools` module +================================================= + +.. automodule:: zaqar.common.api.schemas.pools + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/zaqar.common.response.rst b/doc/source/api/zaqar.common.response.rst deleted file mode 100644 index 2a6300f70..000000000 --- a/doc/source/api/zaqar.common.response.rst +++ /dev/null @@ -1,7 +0,0 @@ -The :mod:`zaqar.common.response` module -======================================== - -.. automodule:: zaqar.common.response - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/zaqar.common.schemas.flavors.rst b/doc/source/api/zaqar.common.schemas.flavors.rst deleted file mode 100644 index 3ce30658e..000000000 --- a/doc/source/api/zaqar.common.schemas.flavors.rst +++ /dev/null @@ -1,7 +0,0 @@ -The :mod:`zaqar.common.schemas.flavors` module -=============================================== - -.. automodule:: zaqar.common.schemas.flavors - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/zaqar.common.schemas.pools.rst b/doc/source/api/zaqar.common.schemas.pools.rst deleted file mode 100644 index 62c3487f2..000000000 --- a/doc/source/api/zaqar.common.schemas.pools.rst +++ /dev/null @@ -1,7 +0,0 @@ -The :mod:`zaqar.common.schemas.pools` module -============================================= - -.. automodule:: zaqar.common.schemas.pools - :members: - :undoc-members: - :show-inheritance: diff --git a/tests/unit/common/test_api.py b/tests/unit/common/test_api.py index 5604b6bf9..f8f467386 100644 --- a/tests/unit/common/test_api.py +++ b/tests/unit/common/test_api.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from zaqar.common import api +from zaqar.common.api import api from zaqar.common import errors from zaqar.tests import base diff --git a/tests/unit/common/test_request.py b/tests/unit/common/test_request.py index f3c6a520c..0cbe9d44f 100644 --- a/tests/unit/common/test_request.py +++ b/tests/unit/common/test_request.py @@ -15,7 +15,7 @@ # limitations under the License. -from zaqar.common import request +from zaqar.common.api import request from zaqar.tests import base diff --git a/zaqar/api/v1/request.py b/zaqar/api/v1/request.py index 933327ea3..c988e26f2 100644 --- a/zaqar/api/v1/request.py +++ b/zaqar/api/v1/request.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from zaqar.common import api +from zaqar.common.api import api class RequestSchema(api.Api): diff --git a/zaqar/api/v1/response.py b/zaqar/api/v1/response.py index c4543ea11..135855ccf 100644 --- a/zaqar/api/v1/response.py +++ b/zaqar/api/v1/response.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from zaqar.common import api +from zaqar.common.api import api class ResponseSchema(api.Api): diff --git a/zaqar/api/v1_1/request.py b/zaqar/api/v1_1/request.py index 9c603adce..262bac48c 100644 --- a/zaqar/api/v1_1/request.py +++ b/zaqar/api/v1_1/request.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from zaqar.common import api +from zaqar.common.api import api class RequestSchema(api.Api): diff --git a/zaqar/api/v1_1/response.py b/zaqar/api/v1_1/response.py index 38ee6ce13..7ee5029f0 100644 --- a/zaqar/api/v1_1/response.py +++ b/zaqar/api/v1_1/response.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from zaqar.common import api +from zaqar.common.api import api class ResponseSchema(api.Api): diff --git a/zaqar/common/schemas/__init__.py b/zaqar/common/api/__init__.py similarity index 100% rename from zaqar/common/schemas/__init__.py rename to zaqar/common/api/__init__.py diff --git a/zaqar/common/api.py b/zaqar/common/api/api.py similarity index 100% rename from zaqar/common/api.py rename to zaqar/common/api/api.py diff --git a/zaqar/common/request.py b/zaqar/common/api/request.py similarity index 100% rename from zaqar/common/request.py rename to zaqar/common/api/request.py diff --git a/zaqar/common/response.py b/zaqar/common/api/response.py similarity index 100% rename from zaqar/common/response.py rename to zaqar/common/api/response.py diff --git a/zaqar/common/api/schemas/__init__.py b/zaqar/common/api/schemas/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/zaqar/common/schemas/flavors.py b/zaqar/common/api/schemas/flavors.py similarity index 100% rename from zaqar/common/schemas/flavors.py rename to zaqar/common/api/schemas/flavors.py diff --git a/zaqar/common/schemas/pools.py b/zaqar/common/api/schemas/pools.py similarity index 100% rename from zaqar/common/schemas/pools.py rename to zaqar/common/api/schemas/pools.py diff --git a/zaqar/transport/wsgi/v1_0/pools.py b/zaqar/transport/wsgi/v1_0/pools.py index bce4cf474..8bf50c72c 100644 --- a/zaqar/transport/wsgi/v1_0/pools.py +++ b/zaqar/transport/wsgi/v1_0/pools.py @@ -38,7 +38,7 @@ registered, there is an optional field:: import falcon import jsonschema -from zaqar.common.schemas import pools as schema +from zaqar.common.api.schemas import pools as schema from zaqar.common import utils as common_utils from zaqar.openstack.common import log from zaqar.storage import errors diff --git a/zaqar/transport/wsgi/v1_1/flavors.py b/zaqar/transport/wsgi/v1_1/flavors.py index 247dd5ce7..3e972895a 100644 --- a/zaqar/transport/wsgi/v1_1/flavors.py +++ b/zaqar/transport/wsgi/v1_1/flavors.py @@ -16,7 +16,7 @@ import falcon import jsonschema -from zaqar.common.schemas import flavors as schema +from zaqar.common.api.schemas import flavors as schema from zaqar.common import utils as common_utils from zaqar.i18n import _ from zaqar.openstack.common import log diff --git a/zaqar/transport/wsgi/v1_1/pools.py b/zaqar/transport/wsgi/v1_1/pools.py index 3c0ed7d08..5dfcc7852 100644 --- a/zaqar/transport/wsgi/v1_1/pools.py +++ b/zaqar/transport/wsgi/v1_1/pools.py @@ -39,7 +39,7 @@ registered, there is an optional field: import falcon import jsonschema -from zaqar.common.schemas import pools as schema +from zaqar.common.api.schemas import pools as schema from zaqar.common import utils as common_utils from zaqar.i18n import _ from zaqar.openstack.common import log