Skip to content

Commit 849ebc5

Browse files
committed
Added brief REST API docs, re #47.
1 parent f03d218 commit 849ebc5

3 files changed

Lines changed: 203 additions & 8 deletions

File tree

api/urls.py

Lines changed: 200 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,199 @@
11
"""
2-
URL routing patterns for the Deis API app.
2+
RESTful URL patterns and routing for the Deis API app.
3+
4+
Keys
5+
====
6+
7+
.. http:get:: /api/keys/(string:id)/
8+
9+
Retrieve a :class:`~api.models.Key` by its id.
10+
11+
.. http:delete:: /api/keys/(string:id)/
12+
13+
Delete a :class:`~api.models.Key` by its id.
14+
15+
.. http:get:: /api/keys/
16+
17+
List all :class:`~api.models.Key`\s.
18+
19+
.. http:post:: /api/keys/
20+
21+
Create a new :class:`~api.models.Key`.
22+
23+
24+
Providers
25+
=========
26+
27+
.. http:get:: /api/providers/(string:id)/
28+
29+
Retrieve a :class:`~api.models.Provider` by its id.
30+
31+
.. http:patch:: /api/providers/(string:id)/
32+
33+
Update parts of a :class:`~api.models.Provider`.
34+
35+
.. http:delete:: /api/providers/(string:id)/
36+
37+
Delete a :class:`~api.models.Provider` by its id.
38+
39+
.. http:get:: /api/providers/
40+
41+
List all :class:`~api.models.Provider`\s.
42+
43+
.. http:post:: /api/providers/
44+
45+
Create a new :class:`~api.models.Provider`.
46+
47+
48+
Flavors
49+
=======
50+
51+
.. http:get:: /api/flavors/(string:id)/
52+
53+
Retrieve a :class:`~api.models.Flavor` by its id.
54+
55+
.. http:patch:: /api/flavors/(string:id)/
56+
57+
Update parts of a :class:`~api.models.Flavor`.
58+
59+
.. http:delete:: /api/flavors/(string:id)/
60+
61+
Delete a :class:`~api.models.Flavor` by its id.
62+
63+
.. http:get:: /api/flavors/
64+
65+
List all :class:`~api.models.Flavor`\s.
66+
67+
.. http:post:: /api/flavors/
68+
69+
Create a new :class:`~api.models.Flavor`.
70+
71+
72+
Formations
73+
==========
74+
75+
.. http:get:: /api/formations/(string:id)/
76+
77+
Retrieve a :class:`~api.models.Formation` by its id.
78+
79+
.. http:delete:: /api/formations/(string:id)/
80+
81+
Delete a :class:`~api.models.Formation` by its id.
82+
83+
.. http:get:: /api/formations/
84+
85+
List all :class:`~api.models.Formation`\s.
86+
87+
.. http:post:: /api/formations/
88+
89+
Create a new :class:`~api.models.Formation`.
90+
91+
Infrastructure
92+
--------------
93+
94+
.. http:get:: /api/formations/(string:id)/layers/(string:id)/
95+
96+
Retrieve a :class:`~api.models.Layer` by its id.
97+
98+
.. http:patch:: /api/formations/(string:id)/layers/(string:id)/
99+
100+
Update parts of a :class:`~api.models.Layer`.
101+
102+
.. http:delete:: /api/formations/(string:id)/layers/(string:id)/
103+
104+
Delete a :class:`~api.models.Layer` by its id.
105+
106+
.. http:get:: /api/formations/(string:id)/layers/
107+
108+
List all :class:`~api.models.Layer`\s.
109+
110+
.. http:post:: /api/formations/(string:id)/layers/
111+
112+
Create a new :class:`~api.models.Layer`.
113+
114+
.. http:get:: /api/formations/(string:id)/nodes/(string:id)/
115+
116+
Retrieve a :class:`~api.models.Node` by its id.
117+
118+
.. http:delete:: /api/formations/(string:id)/nodes/(string:id)/
119+
120+
Delete a :class:`~api.models.Node` by its id.
121+
122+
.. http:get:: /api/formations/(string:id)/nodes/
123+
124+
List all :class:`~api.models.Node`\s.
125+
126+
.. http:get:: /api/formations/(string:id)/containers/
127+
128+
List all :class:`~api.models.Container`\s.
129+
130+
131+
Release Components
132+
------------------
133+
134+
.. http:get:: /api/formations/(string:id)/config/
135+
136+
List all :class:`~api.models.Config`\s.
137+
138+
.. http:post:: /api/formations/(string:id)/config/
139+
140+
Create a new :class:`~api.models.Config`.
141+
142+
.. http:get:: /api/formations/(string:id)/builds/(string:uuid)/
143+
144+
Retrieve a :class:`~api.models.Build` by its uuid.
145+
146+
.. http:post:: /api/formations/(string:id)/builds/
147+
148+
Create a new :class:`~api.models.Build`.
149+
150+
.. http:get:: /api/formations/(string:id)/releases/(int:version)/
151+
152+
Retrieve a :class:`~api.models.Release` by its version.
153+
154+
.. http:get:: /api/formations/(string:id)/releases/
155+
156+
List all :class:`~api.models.Release`\s.
157+
158+
Actions
159+
-------
160+
161+
.. http:post:: /api/formations/(string:id)/scale/layers/
162+
163+
scale_layers
164+
165+
.. http:post:: /api/formations/(string:id)/scale/containers/
166+
167+
scale_containers
168+
169+
.. http:post:: /api/formations/(string:id)/balance/
170+
171+
balance
172+
173+
.. http:post:: /api/formations/(string:id)/calculate/
174+
175+
calculate
176+
177+
.. http:post:: /api/formations/(string:id)/converge/
178+
179+
converge
180+
181+
182+
Auth
183+
====
184+
185+
.. http:post:: /api/auth/register/
186+
187+
Create a new :class:`~api.models.UserRegistration`.
188+
189+
.. http:post:: /api/auth/???
190+
191+
TODO: document the important rest_framework login URLs
192+
193+
.. http:get:: /api/generate-api-key/
194+
195+
Generate an API key.
196+
3197
"""
4198
# pylint: disable=C0103
5199

@@ -38,7 +232,11 @@
38232
'get': 'retrieve', 'patch': 'partial_update', 'delete': 'destroy'})),
39233
url(r'^flavors/?',
40234
views.FlavorViewSet.as_view({'post': 'create', 'get': 'list'})),
41-
235+
# formation base endpoint
236+
url(r'^formations/(?P<id>[a-z0-9-]+)/?',
237+
views.FormationViewSet.as_view({'get': 'retrieve', 'delete': 'destroy'})),
238+
url(r'^formations/?',
239+
views.FormationViewSet.as_view({'post': 'create', 'get': 'list'})),
42240
# formation infrastructure
43241
url(r'^formations/(?P<id>[a-z0-9-]+)/layers/(?P<layer>[a-z0-9-]+)/?',
44242
views.FormationLayerViewSet.as_view({
@@ -74,11 +272,6 @@
74272
views.FormationViewSet.as_view({'post': 'calculate'})),
75273
url(r'^formations/(?P<id>[a-z0-9-]+)/converge/?',
76274
views.FormationViewSet.as_view({'post': 'converge'})),
77-
# formation base endpoint
78-
url(r'^formations/(?P<id>[a-z0-9-]+)/?',
79-
views.FormationViewSet.as_view({'get': 'retrieve', 'delete': 'destroy'})),
80-
url(r'^formations/?',
81-
views.FormationViewSet.as_view({'post': 'create', 'get': 'list'})),
82275

83276
# authn / authz
84277
url(r'^auth/register/?',

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
# Add any Sphinx extension module names here, as strings. They can be extensions
3333
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
34-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.viewcode']
34+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary',
35+
'sphinx.ext.viewcode', 'sphinxcontrib.httpdomain']
3536

3637
# Add any paths that contain templates here, relative to this directory.
3738
templates_path = ['_templates']

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Sphinx>=1.1.3
2+
sphinxcontrib-httpdomain>=1.1.8

0 commit comments

Comments
 (0)