Add query parameter 'id' for security_groups
Add parity with neutronclient which could list security groups filtering by one or multiple security group ids. Change-Id: Iabafad39fe2b54a0c5fa6fe23f1e8ce3c0eab991
This commit is contained in:
parent
1a032b8c60
commit
8b5d4fe798
openstack
network/v2
tests
releasenotes/notes
@ -3150,6 +3150,7 @@ class Proxy(proxy.Proxy):
|
|||||||
the resources being returned. Valid parameters are:
|
the resources being returned. Valid parameters are:
|
||||||
|
|
||||||
* ``description``: Security group description
|
* ``description``: Security group description
|
||||||
|
* ``ìd``: The id of a security group, or list of security group ids
|
||||||
* ``name``: The name of a security group
|
* ``name``: The name of a security group
|
||||||
* ``project_id``: The ID of the project this security group is
|
* ``project_id``: The ID of the project this security group is
|
||||||
associated with.
|
associated with.
|
||||||
|
@ -27,8 +27,8 @@ class SecurityGroup(_base.NetworkResource, resource.TagMixin):
|
|||||||
allow_list = True
|
allow_list = True
|
||||||
|
|
||||||
_query_mapping = resource.QueryParameters(
|
_query_mapping = resource.QueryParameters(
|
||||||
'description', 'fields', 'name', 'stateful', 'project_id', 'tenant_id',
|
'description', 'fields', 'id', 'name', 'stateful', 'project_id',
|
||||||
'revision_number', 'sort_dir', 'sort_key',
|
'tenant_id', 'revision_number', 'sort_dir', 'sort_key',
|
||||||
**resource.TagMixin._tag_query_parameters
|
**resource.TagMixin._tag_query_parameters
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,6 +46,10 @@ class TestSecurityGroup(base.BaseFunctionalTest):
|
|||||||
names = [o.name for o in self.conn.network.security_groups()]
|
names = [o.name for o in self.conn.network.security_groups()]
|
||||||
self.assertIn(self.NAME, names)
|
self.assertIn(self.NAME, names)
|
||||||
|
|
||||||
|
def test_list_query_list_of_ids(self):
|
||||||
|
ids = [o.id for o in self.conn.network.security_groups(id=[self.ID])]
|
||||||
|
self.assertIn(self.ID, ids)
|
||||||
|
|
||||||
def test_set_tags(self):
|
def test_set_tags(self):
|
||||||
sot = self.conn.network.get_security_group(self.ID)
|
sot = self.conn.network.get_security_group(self.ID)
|
||||||
self.assertEqual([], sot.tags)
|
self.assertEqual([], sot.tags)
|
||||||
|
@ -80,6 +80,7 @@ class TestSecurityGroup(base.TestCase):
|
|||||||
self.assertDictEqual({'any_tags': 'tags-any',
|
self.assertDictEqual({'any_tags': 'tags-any',
|
||||||
'description': 'description',
|
'description': 'description',
|
||||||
'fields': 'fields',
|
'fields': 'fields',
|
||||||
|
'id': 'id',
|
||||||
'limit': 'limit',
|
'limit': 'limit',
|
||||||
'marker': 'marker',
|
'marker': 'marker',
|
||||||
'name': 'name',
|
'name': 'name',
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The ``id`` field was added a query parameter for security_groups. A single
|
||||||
|
security group id, or a list of security group ids can be passed. For
|
||||||
|
example::
|
||||||
|
|
||||||
|
conn.network.security_groups(id=['f959e85a-1a87-4b5c-ae56-dc917ceeb584',
|
||||||
|
'a55c0100-7ded-40af-9c61-1d1b9a9c2692'])
|
Loading…
x
Reference in New Issue
Block a user