Add API documentation

Clean up table formatting in the module header and add directive to
auto-doc the module.

Closes-Bug: #1415623

Change-Id: Iebf7e9cf88eae822d0d604a9557d45a170c679d9
This commit is contained in:
Doug Hellmann 2015-01-28 14:46:05 -05:00
parent 7f209c639f
commit 32a3708e27
2 changed files with 12 additions and 17 deletions

View File

@ -2,11 +2,5 @@
API
=====
.. Use autodoc directives to describe the *public* modules and classes
in the library.
If the modules are completely unrelated, create an api subdirectory
and use a separate file for each (see oslo.utils).
If there is only one submodule, a single api.rst file like this
sufficient (see oslo.i18n).
.. automodule:: oslo_policy.policy
:members:

View File

@ -34,28 +34,29 @@ new way: the policy language.
In the policy language, each check is specified the same way as in the
list-of-lists representation: a simple "a:b" pair that is matched to
the correct class to perform that check::
the correct class to perform that check:
+===========================================================================+
+--------------------------------+------------------------------------------+
| TYPE | SYNTAX |
+===========================================================================+
+================================+==========================================+
|User's Role | role:admin |
+---------------------------------------------------------------------------+
+--------------------------------+------------------------------------------+
|Rules already defined on policy | rule:admin_required |
+---------------------------------------------------------------------------+
+--------------------------------+------------------------------------------+
|Against URL's¹ | http://my-url.org/check |
+---------------------------------------------------------------------------+
+--------------------------------+------------------------------------------+
|User attributes² | project_id:%(target.project.id)s |
+---------------------------------------------------------------------------+
+--------------------------------+------------------------------------------+
|Strings | <variable>:'xpto2035abc' |
| | 'myproject':<variable> |
+---------------------------------------------------------------------------+
+--------------------------------+------------------------------------------+
| | project_id:xpto2035abc |
|Literals | domain_id:20 |
| | True:%(user.enabled)s |
+===========================================================================+
+--------------------------------+------------------------------------------+
¹URL checking must return 'True' to be valid
²User attributes (obtained through the token): user_id, domain_id or project_id
Conjunction operators are available, allowing for more expressiveness