summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDavanum Srinivas <davanum@gmail.com>2017-10-09 12:05:10 -0400
committerDavanum Srinivas (dims) <davanum@gmail.com>2017-10-16 11:49:31 +0000
commit7ade2ed547e690d4737114af467088df17a63ac8 (patch)
tree6da6ece539a0262f234e2903871a6ab7732d49fa /doc
parente673152a64c138cecc2d9294c966f0ee5162e94b (diff)
downloadoslo-policy-7ade2ed547e690d4737114af467088df17a63ac8.tar.gz
Documentation and release notes for plugins1.29.0
In Icde2b26a38d7c7842defae053228d9208454b969, we added support for stevedore based external/custom plugins. In this changeset, we add a release note and documentation on how things work. Change-Id: Ie0b773dc1147f5ef898d17e8f84c946c39fdf5cd
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/source/conf.py7
-rw-r--r--doc/source/user/index.rst1
-rw-r--r--doc/source/user/plugins.rst51
3 files changed, 59 insertions, 0 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 5797d62..16f161e 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -22,6 +22,7 @@ sys.path.insert(0, os.path.abspath('../..'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
+ 'sphinx.ext.extlinks',
#'sphinx.ext.intersphinx',
'openstackdocstheme',
'oslo_config.sphinxext',
@@ -50,6 +51,7 @@ exclude_patterns = ['api/oslo_policy.tests.*', 'api/setup.rst']
# General information about the project.
project = u'oslo.policy'
copyright = u'2014, OpenStack Foundation'
+source_tree = 'https://git.openstack.org/cgit/openstack/oslo.policy/tree'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
@@ -86,5 +88,10 @@ latex_documents = [
u'OpenStack Foundation', 'manual'),
]
+# Shortened external links.
+extlinks = {
+ 'example': (source_tree + '/oslo_policy/%s', ''),
+}
+
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst
index cfb053b..47af2bb 100644
--- a/doc/source/user/index.rst
+++ b/doc/source/user/index.rst
@@ -5,6 +5,7 @@
.. toctree::
usage
+ plugins
sphinxpolicygen
history
diff --git a/doc/source/user/plugins.rst b/doc/source/user/plugins.rst
new file mode 100644
index 0000000..54d2dda
--- /dev/null
+++ b/doc/source/user/plugins.rst
@@ -0,0 +1,51 @@
+==========================
+Writing custom check rules
+==========================
+
+oslo.policy has supported the following syntax for a while::
+
+ http:<target URL>, which delegates the check to a remote server
+
+
+Starting with 1.29, oslo.policy will also support https url(s) as well::
+
+ https:<target URL>, which delegates the check to a remote server
+
+
+Both ``http`` and ``https`` support are implemented as custom check rules.
+If you see the setup.cfg for oslo.policy, you can see the following
+entry points::
+
+ oslo.policy.rule_checks =
+ http = oslo_policy._external:HttpCheck
+ https = oslo_policy._external:HttpsCheck
+
+When a policy is evaluated, when the engine encounters ``https`` like in
+a snippet below::
+
+ {
+ ...
+ "target 1" : "https://foo.bar/baz",
+ ...
+ }
+
+The engine will look for a plugin named ``https`` in the ``rule_checks``
+entry point and will try to invoke that stevedore plugin.
+
+This mechanism allows anyone to write their own code, in their own library
+with their own custom stevedore based rule check plugins and can enhance
+their policies with custom checks. This would be useful for example to
+integrate with a in-house policy server.
+
+
+Example code - HttpCheck
+========================
+
+.. note::
+
+ Full source located at :example:`_external.py`
+
+.. literalinclude:: ../../../oslo_policy/_external.py
+ :language: python
+ :linenos:
+ :lines: 28-64 \ No newline at end of file