Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
commit d8d5e4c4ec8f1b1ab6221bc3130910716cbc723d Author: Valentin Gologuzov vgologuz@redhat.com Date: Thu Sep 3 23:27:05 2015 +0200
[frontend][API docs] covered MockChroots
frontend/coprs_frontend/coprs/rest_api/common.py | 1 - .../coprs/rest_api/resources/mock_chroot.py | 1 - .../docs/api_2/source/Resources/mock_chroot.rst | 126 ++++++++++++++++++++ .../docs/api_2/source/Resources/project_chroot.rst | 3 +- frontend/docs/api_2/source/index.rst | 30 +++-- 5 files changed, 143 insertions(+), 18 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/rest_api/common.py b/frontend/coprs_frontend/coprs/rest_api/common.py index 124ed83..01a787e 100644 --- a/frontend/coprs_frontend/coprs/rest_api/common.py +++ b/frontend/coprs_frontend/coprs/rest_api/common.py @@ -71,7 +71,6 @@ def render_build_chroot(chroot): }
- def rest_api_auth_required(f): # todo: move to common.py and test this @functools.wraps(f) diff --git a/frontend/coprs_frontend/coprs/rest_api/resources/mock_chroot.py b/frontend/coprs_frontend/coprs/rest_api/resources/mock_chroot.py index 2255d4b..c7135de 100644 --- a/frontend/coprs_frontend/coprs/rest_api/resources/mock_chroot.py +++ b/frontend/coprs_frontend/coprs/rest_api/resources/mock_chroot.py @@ -14,7 +14,6 @@ def render_mock_chroot(chroot): "chroot": MockChrootSchema().dump(chroot)[0], "_links": { "self": {"href": url_for(".mockchrootr", name=chroot.name)}, - "all_chroots": {"href": url_for(".mockchrootlistr")} }, }
diff --git a/frontend/docs/api_2/source/Resources/mock_chroot.rst b/frontend/docs/api_2/source/Resources/mock_chroot.rst index e69de29..a01d11a 100644 --- a/frontend/docs/api_2/source/Resources/mock_chroot.rst +++ b/frontend/docs/api_2/source/Resources/mock_chroot.rst @@ -0,0 +1,126 @@ +Mock Chroot +=========== + +Mock chroot resources represents available chroots for builds. API provides only read-only access, +since configuration of the build chroots is done by the service administrator. + +Structure of the mock chroot entity +----------------------------------- + +.. code-block:: javascript + + { + "name": "epel-6-i386", + "os_release": "epel", + "os_version": "6", + "arch": "i386", + "is_active": true + } + +Mock Chroot fields +~~~~~~~~~~~~~~~~~~ +================== ==================== =============== +Field Type Description +================== ==================== =============== +name str chroot name +os_release str name of distribution system, e.g.: epel, fedora +os_version str version of distribution system, e.g.: 7, 22 +arch str architecture of distribution, e.g.: i386, x86_64, ppc64le +is_active bool defines if this chroot is available for builds +================== ==================== =============== + +List mock chroots +----------------- +.. http:get:: /api_2/mock_chroots + + Returns a list of mock chroots + + :query param active_only: when set to True shows only active mock chroots + + :statuscode 200: no error + + **Example request**: + + .. sourcecode:: http + + GET /api_2/mock_chroots?active_only=True HTTP/1.1 + Host: copr.fedoraproject.org + Accept: application/json + + **Response**: + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json + + { + "chroots": [ + { + "chroot": { + "name": "epel-6-i386", + "os_release": "epel", + "os_version": "6", + "arch": "i386", + "is_active": true + }, + "_links": { + "self": { + "href": "/api_2/mock_chroots/epel-6-i386" + } + } + }, + { }, + ], + "_links": { + "self": { + "href": "/api_2/mock_chroots?active_only=True" + } + } + } + +Get mock chroot details +----------------------- +.. http:get:: /api_2/mock_chroots/(str:chroot_name) + + Returns mock chroot details + + :param str chroot_name: Uniquer mock chroot name + + + :statuscode 200: no error + :statuscode 404: mock chroot not found by the given name + + **Example request** + + .. sourcecode:: http + + GET /api_2/mock_chroots/fedora-rawhide-i386 HTTP/1.1 + Host: copr.fedoraproject.org + Accept: application/json + + **Response** + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json + + { + "chroot": { + "name": "fedora-rawhide-i386", + "os_release": "fedora", + "os_version": "rawhide", + "arch": "i386", + "is_active": true + }, + "_links": { + "self": { + "href": "/api_2/mock_chroots/fedora-rawhide-i386" + }, + "all_chroots": { + "href": "/api_2/mock_chroots" + } + } + } + diff --git a/frontend/docs/api_2/source/Resources/project_chroot.rst b/frontend/docs/api_2/source/Resources/project_chroot.rst index d63dec7..a865afd 100644 --- a/frontend/docs/api_2/source/Resources/project_chroot.rst +++ b/frontend/docs/api_2/source/Resources/project_chroot.rst @@ -3,7 +3,7 @@ Project Chroot
Projects Chroots allows to view and modify project settings dedicated for different chroots.
-Structure if the project chroot entity +Structure of the project chroot entity --------------------------------------
.. code-block:: javascript @@ -206,7 +206,6 @@ Modify project chroot --------------------- .. http:put:: /api_2/projects/(int:project_id)/chroots/(str:chroot_name)
- **REQUIRE AUTH**
Updated project chroot settings diff --git a/frontend/docs/api_2/source/index.rst b/frontend/docs/api_2/source/index.rst index 5570793..49cae2b 100644 --- a/frontend/docs/api_2/source/index.rst +++ b/frontend/docs/api_2/source/index.rst @@ -14,6 +14,22 @@ Endpoint of the the API is ``/api_2``, public data is available without authoriz To create new projects, submit builds and do other modification requests you will need to provide API token using BasicAuth_ . Token can be obtained and renewed at the CoprAPI_ page.
+Resources +--------- +.. toctree:: + :maxdepth: 1 + + Resources/project + Resources/project_chroot + Resources/build + Resources/build_chroot + Resources/mock_chroot + + +HETEOAS +------- + + This API implements HETEOAS_ in the very simple form: each entity is accompanied with set of relative links to other related entities. HETEOAS makes API self discoverable, so you shouldn't learn how to access sub-resources. Here is a short example with the content of API root: @@ -89,20 +105,6 @@ Errors ______ todo:
- -Resources ---------- - -================== ============ -Resource Description -================== ============ -Project_ represents copr projects and operations with them. -`Project Chroot`_ allows to view and edit project settings specific for different chroots -================== ============ - .. _BasicAuth: https://en.wikipedia.org/wiki/Basic_access_authentication .. _CoprAPI: https://copr.fedoraproject.org/api .. _HETEOAS: https://en.wikipedia.org/wiki/HATEOAS - -.. _Project: Resources/project.html -.. _Project Chroot: Resources/project_chroot.html
copr-commits@lists.fedorahosted.org