summaryrefslogtreecommitdiff
path: root/doc/source/api.rst
blob: 1e184bbf4bb50d0a29c45b6b9ad1dc3cea86c8bb (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
The :mod:`cinderclient` Python API
==================================

.. module:: cinderclient
   :synopsis: A client for the OpenStack Nova API.

.. currentmodule:: cinderclient

Usage
-----

First create an instance of :class:`OpenStack` with your credentials::

    >>> from cinderclient import OpenStack
    >>> cinder = OpenStack(USERNAME, PASSWORD, AUTH_URL)

Then call methods on the :class:`OpenStack` object:

.. class:: OpenStack

    .. attribute:: backup_schedules

        A :class:`BackupScheduleManager` -- manage automatic backup images.

    .. attribute:: flavors

        A :class:`FlavorManager` -- query available "flavors" (hardware
        configurations).

    .. attribute:: images

        An :class:`ImageManager` -- query and create server disk images.

    .. attribute:: ipgroups

        A :class:`IPGroupManager` -- manage shared public IP addresses.

    .. attribute:: servers

        A :class:`ServerManager` -- start, stop, and manage virtual machines.

    .. automethod:: authenticate

For example::

    >>> cinder.servers.list()
    [<Server: buildslave-ubuntu-9.10>]

    >>> cinder.flavors.list()
    [<Flavor: 256 server>,
     <Flavor: 512 server>,
     <Flavor: 1GB server>,
     <Flavor: 2GB server>,
     <Flavor: 4GB server>,
     <Flavor: 8GB server>,
     <Flavor: 15.5GB server>]

    >>> fl = cinder.flavors.find(ram=512)
    >>> cinder.servers.create("my-server", flavor=fl)
    <Server: my-server>

For more information, see the reference:

.. toctree::
   :maxdepth: 2

   ref/index