Merge "Allow search on objects"
This commit is contained in:
commit
6432c42778
@ -7839,6 +7839,23 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
container, params=dict(format='json'))
|
container, params=dict(format='json'))
|
||||||
return self._get_and_munchify(None, data)
|
return self._get_and_munchify(None, data)
|
||||||
|
|
||||||
|
def search_objects(self, container, name=None, filters=None):
|
||||||
|
"""Search objects.
|
||||||
|
|
||||||
|
:param string name: object name.
|
||||||
|
:param filters: a dict containing additional filters to use.
|
||||||
|
OR
|
||||||
|
A string containing a jmespath expression for further filtering.
|
||||||
|
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
|
||||||
|
|
||||||
|
:returns: a list of ``munch.Munch`` containing the objects.
|
||||||
|
|
||||||
|
:raises: ``OpenStackCloudException``: if something goes wrong during
|
||||||
|
the OpenStack API call.
|
||||||
|
"""
|
||||||
|
objects = self.list_objects(container)
|
||||||
|
return _utils._filter_list(objects, name, filters)
|
||||||
|
|
||||||
def delete_object(self, container, name, meta=None):
|
def delete_object(self, container, name, meta=None):
|
||||||
"""Delete an object from a container.
|
"""Delete an object from a container.
|
||||||
|
|
||||||
|
6
releasenotes/notes/object-search-a5f5ec4b2df3e045.yaml
Normal file
6
releasenotes/notes/object-search-a5f5ec4b2df3e045.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Objects are now searchable both with a JMESPath expression or a dict of
|
||||||
|
object attributes via the
|
||||||
|
``openstack.connection.Connection.search_object`` function.
|
Loading…
x
Reference in New Issue
Block a user