File: api.rst

package info (click to toggle)
python-gnocchiclient 7.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: python: 3,219; makefile: 36; sh: 26
file content (45 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
The :mod:`gnocchiclient` Python API
===================================

.. module:: gnocchiclient
   :synopsis: A client for the Gnocchi API.

.. currentmodule:: gnocchiclient

Usage
-----

To use gnocchiclient in a project::

    >>> from gnocchiclient import auth
    >>> from gnocchiclient.v1 import client
    >>>
    >>> auth_plugin = auth.GnocchiBasicPlugin(user="admin",
    >>>                                       endpoint="http://localhost:8041")
    >>> gnocchi = client.Client(session_options={'auth': auth_plugin})
    >>> gnocchi.resource.list("generic")

With authentication from a keystoneauth1 plugins::

    >>> from keystoneauth1 import loading
    >>> from oslo_config import cfg
    >>> from gnocchiclient import auth
    >>> from gnocchiclient.v1 import client
    >>>
    >>> conf = cfg.ConfigOpts()
    >>> ...
    >>> auth_plugin = loading.load_auth_from_conf_options(conf, "gnocchi_credentials")
    >>> gnocchi = client.Client(session_options={'auth': auth_plugin})
    >>> gnocchi.resource.list("generic")


Reference
---------

For more information, see the reference:

.. toctree::
   :maxdepth: 2

   api/autoindex