~hudson-openstack/glance/milestone-proposed

« back to all changes in this revision

Viewing changes to doc/source/client.rst

  • Committer: Tarmac
  • Author(s): Brian Waldon, Yuriy Taraday, Justin Shepherd, Ewan Mellor, Thierry Carrez
  • Date: 2011-06-28 19:42:20 UTC
  • mfrom: (139.9.1 d2-merge)
  • Revision ID: tarmac-20110628194220-rhxw4nwelxeolztc
Merge diablo-2 development work

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
  c = Client("glance.example.com", 9292)
114
114
 
115
115
  filters = {'status': 'saving', 'size_max': (5 * 1024 * 1024 * 1024)}
116
 
  print c.get_images_detailed(filters)
 
116
  print c.get_images_detailed(filters=filters)
 
117
 
 
118
Sorting Images Returned via ``get_images()`` and ``get_images_detailed()``
 
119
--------------------------------------------------------------------------
 
120
 
 
121
Two parameters are available to sort the list of images returned by
 
122
these methods.
 
123
 
 
124
* ``sort_key: KEY``
 
125
 
 
126
  Images can be ordered by the image attribute ``KEY``. Acceptable values:
 
127
  ``id``, ``name``, ``status``, ``container_format``, ``disk_format``,
 
128
  ``created_at`` (default) and ``updated_at``.
 
129
 
 
130
* ``sort_dir: DIR``
 
131
 
 
132
  The direction of the sort may be defined by ``DIR``. Accepted values:
 
133
  ``asc`` for ascending or ``desc`` (default) for descending.
 
134
 
 
135
The following example will return a list of images sorted alphabetically
 
136
by name in ascending order.
 
137
 
 
138
.. code-block:: python
 
139
 
 
140
  from glance.client import Client
 
141
 
 
142
  c = Client("glance.example.com", 9292)
 
143
 
 
144
  print c.get_images(sort_key='name', sort_dir='asc')
 
145
 
117
146
 
118
147
Requesting Detailed Metadata on a Specific Image
119
148
------------------------------------------------