summaryrefslogtreecommitdiff
path: root/doc/source/api.rst
diff options
context:
space:
mode:
authorNejc Saje <nsaje@redhat.com>2014-08-25 06:22:17 -0400
committerNejc Saje <nsaje@redhat.com>2014-08-27 12:03:21 -0400
commit69da9cd23165606b4b072dbe6653bf968b32ffaf (patch)
tree7f771620613d32f597f4b6d851c85898d7097654 /doc/source/api.rst
parent98127c4e40a37353fe486483ffc9b8ac25c27474 (diff)
downloadpython-ceilometerclient-69da9cd23165606b4b072dbe6653bf968b32ffaf.tar.gz
Revamp documentation, add module references
Documentation is modeled after python-novaclient docs. (http://docs.openstack.org/developer/python-novaclient/) Built preview for reviewers: https://nsaje.fedorapeople.org/python-ceilometerclient/ Change-Id: I61e9d6593e4a1aea5cf018081416d4be3a9372ac
Diffstat (limited to 'doc/source/api.rst')
-rw-r--r--doc/source/api.rst48
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/source/api.rst b/doc/source/api.rst
new file mode 100644
index 0000000..85769c6
--- /dev/null
+++ b/doc/source/api.rst
@@ -0,0 +1,48 @@
+The :mod:`ceilometerclient` Python API
+======================================
+
+.. module:: ceilometerclient
+ :synopsis: A client for the OpenStack Ceilometer API.
+
+.. currentmodule:: ceilometerclient
+
+Usage
+-----
+
+First create a client instance with your credentials::
+
+ >>> import ceilometerclient.client
+ >>> cclient = ceilometerclient.client.get_client(VERSION, username=USERNAME, password=PASSWORD, tenant_name=PROJECT_NAME, auth_url=AUTH_URL)
+
+Here ``VERSION`` can be: ``1`` and ``2``.
+
+Then call methods on its managers::
+
+ >>> cclient.meters.list()
+ [<Meter ...>, ...]
+
+ >>> cclient.samples.list()
+ [<Sample ...>, ...]
+
+V2 client tips
+++++++++++++++
+
+Use queries to narrow your search (more info at `Ceilometer V2 API reference`__)::
+
+ >>> query = [dict(field='resource_id', op='eq', value='5a301761-f78b-46e2-8900-8b4f6fe6675a')]
+ >>> ceilometer.samples.list(meter_name='cpu_util', limit=10, q=query)
+ [<Sample ...>, ...]
+
+__ http://docs.openstack.org/developer/ceilometer/webapi/v2.html#Query
+
+Reference
+---------
+
+For more information, see the reference:
+
+.. toctree::
+ :maxdepth: 2
+
+ ref/index
+ ref/v1/index
+ ref/v2/index