summaryrefslogtreecommitdiff
path: root/openstackclient/api/image_v2.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2015-01-21 15:02:58 -0600
committerDean Troyer <dtroyer@gmail.com>2015-01-27 19:17:35 -0600
commit61a40343fdbb89a1c6404ab03fcfd84daee31c9e (patch)
tree8b34e7f8ba5d26a911023cc447308c21e7dcd612 /openstackclient/api/image_v2.py
parent2c03f6f42fc17ca145e527cc87a7c2e7043e32c7 (diff)
downloadpython-openstackclient-61a40343fdbb89a1c6404ab03fcfd84daee31c9e.tar.gz
Add filter to image list
* Hides previously broken --page-size option * Adds --property to image list for filtering on properties * Adds Visibility, Protected, Owner, Properties/Tags to --long output * Adds api.utils.simple_filter() for selecting matches out of a list of objects * Adds tests for all of the above * Updates image docs There are additional filtering options to be added in later reviews. Change-Id: I32feff0ad61aae749b33621c817658d7dc90c3aa Closes-bug: 1401902
Diffstat (limited to 'openstackclient/api/image_v2.py')
-rw-r--r--openstackclient/api/image_v2.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/openstackclient/api/image_v2.py b/openstackclient/api/image_v2.py
index c5c78431..37c2ed83 100644
--- a/openstackclient/api/image_v2.py
+++ b/openstackclient/api/image_v2.py
@@ -30,6 +30,7 @@ class APIv2(image_v1.APIv1):
detailed=False,
public=False,
private=False,
+ shared=False,
**filter
):
"""Get available images
@@ -49,17 +50,17 @@ class APIv2(image_v1.APIv1):
both public and private images which is the same set as all images.
http://docs.openstack.org/api/openstack-image-service/2.0/content/list-images.html
-
- TODO(dtroyer): Implement filtering
"""
- if public == private:
- # No filtering for both False and both True cases
+ if not public and not private and not shared:
+ # No filtering for all False
filter.pop('visibility', None)
elif public:
filter['visibility'] = 'public'
elif private:
filter['visibility'] = 'private'
+ elif shared:
+ filter['visibility'] = 'shared'
url = "/images"
if detailed: