| 1 |
The :mod:`freezerclient` Python API |
| 2 |
|
| 3 |
.. module:: freezerclient |
| 4 |
:synopsis: A client for the OpenStack Freezer API. |
| 5 |
|
| 6 |
.. currentmodule:: freezerclient |
| 7 |
|
| 8 |
Basic Usage |
| 9 |
----------- |
| 10 |
|
| 11 |
First create a client instance using a keystoneauth Session. For more |
| 12 |
information on this keystoneauth API, see `Using Sessions`_. |
| 13 |
|
| 14 |
.. _Using Sessions: https://docs.openstack.org/keystoneauth/latest/using-sessions.html |
| 15 |
|
| 16 |
.. code-block:: python |
| 17 |
|
| 18 |
>>> from keystoneauth1 import identity |
| 19 |
>>> from keystoneauth1 import session |
| 20 |
>>> from freezerclient import client |
| 21 |
>>> username='username' |
| 22 |
>>> password='password' |
| 23 |
>>> project_name='demo' |
| 24 |
>>> project_domain_id='default' |
| 25 |
>>> user_domain_id='default' |
| 26 |
>>> auth_url='http://auth.example.com:5000/v3' |
| 27 |
>>> auth = identity.Password(auth_url=auth_url, |
| 28 |
... username=username, |
| 29 |
... password=password, |
| 30 |
... project_name=project_name, |
| 31 |
... project_domain_id=project_domain_id, |
| 32 |
... user_domain_id=user_domain_id) |
| 33 |
>>> sess = session.Session(auth=auth) |
| 34 |
>>> freezer = client.Client(version='2',session=sess) |
| 35 |
|
| 36 |
It is also possible to use an instance as a context manager in which case |
| 37 |
there will be a session kept alive for the duration of the with statement:: |
| 38 |
|
| 39 |
>>> from freezerclient import client |
| 40 |
>>> freezer = client.Client('2') |
| 41 |
>>> freezer.jobs.list_all() |