Merge lp:~jaypipes/glance/docs into lp:~hudson-openstack/glance/trunk

Proposed by Jay Pipes
Status: Merged
Approved by: Brian Waldon
Approved revision: 130
Merged at revision: 134
Proposed branch: lp:~jaypipes/glance/docs
Merge into: lp:~hudson-openstack/glance/trunk
Diff against target: 163 lines (+124/-1)
3 files modified
doc/source/client.rst (+51/-1)
doc/source/glanceapi.rst (+36/-0)
doc/source/registries.rst (+37/-0)
To merge this branch: bzr merge lp:~jaypipes/glance/docs
Reviewer Review Type Date Requested Status
Mark Washenberger (community) Approve
Brian Waldon (community) Approve
Glance Core security contacts Pending
Review via email: mp+62322@code.launchpad.net

Description of the change

Documentation for new results filtering in the API and client.

To post a comment you must log in.
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Looks good, Jay. Sorry I didn't do this in my original branch. I did find one typo

14: simple should be simply

review: Needs Fixing
Revision history for this message
Jay Pipes (jaypipes) wrote :

fixed typo.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Good to go

review: Approve
Revision history for this message
Mark Washenberger (markwash) wrote :

Looks good to me. It seems silly, but I feel weird about the use of the verb "to detail" right in the context of a URL resource called "/detail"--but I don't think its actually a problem.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/source/client.rst'
2--- doc/source/client.rst 2011-01-26 20:47:01 +0000
3+++ doc/source/client.rst 2011-05-25 20:06:01 +0000
4@@ -63,6 +63,57 @@
5
6 print c.get_images_detailed()
7
8+Filtering Images Returned via ``get_images()`` and ``get_images_detailed()``
9+----------------------------------------------------------------------------
10+
11+Both the ``get_images()`` and ``get_images_detailed()`` methods take query
12+parameters that serve to filter the returned list of images.
13+
14+When calling, simply pass an optional dictionary to the method containing
15+the filters by which you wish to limit results, with the filter keys being one
16+or more of the below:
17+
18+* ``name: NAME``
19+
20+ Filters images having a ``name`` attribute matching ``NAME``.
21+
22+* ``container_format: FORMAT``
23+
24+ Filters images having a ``container_format`` attribute matching ``FORMAT``
25+
26+ For more information, see :doc:`About Disk and Container Formats <formats>`
27+
28+* ``disk_format: FORMAT``
29+
30+ Filters images having a ``disk_format`` attribute matching ``FORMAT``
31+
32+ For more information, see :doc:`About Disk and Container Formats <formats>`
33+
34+* ``status: STATUS``
35+
36+ Filters images having a ``status`` attribute matching ``STATUS``
37+
38+ For more information, see :doc:`About Image Statuses <statuses>`
39+
40+* ``size_min: BYTES``
41+
42+ Filters images having a ``size`` attribute greater than or equal to ``BYTES``
43+
44+* ``size_max: BYTES``
45+
46+ Filters images having a ``size`` attribute less than or equal to ``BYTES``
47+
48+Here's a quick example that will return all images less than or equal to 5G
49+in size and in the `saving` status.
50+
51+.. code-block:: python
52+
53+ from glance.client import Client
54+
55+ c = Client("glance.example.com", 9292)
56+
57+ filters = {'status': 'saving', 'size_max': (5 * 1024 * 1024 * 1024)}
58+ print c.get_images_detailed(filters)
59
60 Requesting Detailed Metadata on a Specific Image
61 ------------------------------------------------
62@@ -86,7 +137,6 @@
63
64 print c.get_image_meta("http://glance.example.com/images/1")
65
66-
67 Retrieving a Virtual Machine Image
68 ----------------------------------
69
70
71=== modified file 'doc/source/glanceapi.rst'
72--- doc/source/glanceapi.rst 2011-04-12 21:45:16 +0000
73+++ doc/source/glanceapi.rst 2011-05-25 20:06:01 +0000
74@@ -92,6 +92,42 @@
75
76 The `checksum` field is an MD5 checksum of the image file data
77
78+Filtering Images Returned via ``GET /images`` and ``GET /images/detail``
79+------------------------------------------------------------------------
80+
81+Both the ``GET /images`` and ``GET /images/detail`` requests take query
82+parameters that serve to filter the returned list of images. The following
83+list details these query parameters.
84+
85+* ``name=NAME``
86+
87+ Filters images having a ``name`` attribute matching ``NAME``.
88+
89+* ``container_format=FORMAT``
90+
91+ Filters images having a ``container_format`` attribute matching ``FORMAT``
92+
93+ For more information, see :doc:`About Disk and Container Formats <formats>`
94+
95+* ``disk_format=FORMAT``
96+
97+ Filters images having a ``disk_format`` attribute matching ``FORMAT``
98+
99+ For more information, see :doc:`About Disk and Container Formats <formats>`
100+
101+* ``status=STATUS``
102+
103+ Filters images having a ``status`` attribute matching ``STATUS``
104+
105+ For more information, see :doc:`About Image Statuses <statuses>`
106+
107+* ``size_min=BYTES``
108+
109+ Filters images having a ``size`` attribute greater than or equal to ``BYTES``
110+
111+* ``size_max=BYTES``
112+
113+ Filters images having a ``size`` attribute less than or equal to ``BYTES``
114
115 Requesting Detailed Metadata on a Specific Image
116 ------------------------------------------------
117
118=== modified file 'doc/source/registries.rst'
119--- doc/source/registries.rst 2011-02-25 14:55:26 +0000
120+++ doc/source/registries.rst 2011-05-25 20:06:01 +0000
121@@ -46,6 +46,43 @@
122 PUT /images/<ID> Update metadata about an existing image
123 DELETE /images/<ID> Remove an image's metadata from the registry
124
125+Filtering Images Returned via ``GET /images`` and ``GET /images/detail``
126+------------------------------------------------------------------------
127+
128+Both the ``GET /images`` and ``GET /images/detail`` requests take query
129+parameters that serve to filter the returned list of images. The following
130+list details these query parameters.
131+
132+* ``name=NAME``
133+
134+ Filters images having a ``name`` attribute matching ``NAME``.
135+
136+* ``container_format=FORMAT``
137+
138+ Filters images having a ``container_format`` attribute matching ``FORMAT``
139+
140+ For more information, see :doc:`About Disk and Container Formats <formats>`
141+
142+* ``disk_format=FORMAT``
143+
144+ Filters images having a ``disk_format`` attribute matching ``FORMAT``
145+
146+ For more information, see :doc:`About Disk and Container Formats <formats>`
147+
148+* ``status=STATUS``
149+
150+ Filters images having a ``status`` attribute matching ``STATUS``
151+
152+ For more information, see :doc:`About Image Statuses <statuses>`
153+
154+* ``size_min=BYTES``
155+
156+ Filters images having a ``size`` attribute greater than or equal to ``BYTES``
157+
158+* ``size_max=BYTES``
159+
160+ Filters images having a ``size`` attribute less than or equal to ``BYTES``
161+
162 ``POST /images``
163 ----------------
164

Subscribers

People subscribed via source and target branches