Merge "Add bulk creation of rules for Security Group."
This commit is contained in:
commit
ab89de58de
@ -124,6 +124,7 @@ Security Group Operations
|
||||
.. automethod:: openstack.network.v2._proxy.Proxy.security_groups
|
||||
|
||||
.. automethod:: openstack.network.v2._proxy.Proxy.create_security_group_rule
|
||||
.. automethod:: openstack.network.v2._proxy.Proxy.create_security_group_rules
|
||||
.. automethod:: openstack.network.v2._proxy.Proxy.delete_security_group_rule
|
||||
|
||||
Availability Zone Operations
|
||||
|
@ -3190,6 +3190,21 @@ class Proxy(proxy.Proxy):
|
||||
"""
|
||||
return self._create(_security_group_rule.SecurityGroupRule, **attrs)
|
||||
|
||||
def create_security_group_rules(self, data):
|
||||
"""Create new security group rules from the list of attributes
|
||||
|
||||
:param list data: List of dicts of attributes which will be used to
|
||||
create a :class:`~openstack.network.v2.\
|
||||
security_group_rule.SecurityGroupRule`,
|
||||
comprised of the properties on the SecurityGroupRule
|
||||
class.
|
||||
|
||||
:returns: A generator of security group rule objects
|
||||
:rtype: :class:`~openstack.network.v2.security_group_rule.\
|
||||
SecurityGroupRule`
|
||||
"""
|
||||
return self._bulk_create(_security_group_rule.SecurityGroupRule, data)
|
||||
|
||||
def delete_security_group_rule(self, security_group_rule,
|
||||
ignore_missing=True, if_revision=None):
|
||||
"""Delete a security group rule
|
||||
|
@ -1163,6 +1163,14 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
self.verify_list(self.proxy.security_group_rules,
|
||||
security_group_rule.SecurityGroupRule)
|
||||
|
||||
@mock.patch('openstack.network.v2._proxy.Proxy._bulk_create')
|
||||
def test_security_group_rules_create(self, bc):
|
||||
data = mock.sentinel
|
||||
|
||||
self.proxy.create_security_group_rules(data)
|
||||
|
||||
bc.assert_called_once_with(security_group_rule.SecurityGroupRule, data)
|
||||
|
||||
def test_segment_create_attrs(self):
|
||||
self.verify_create(self.proxy.create_segment, segment.Segment)
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- Added bulk create securtiy groups rules. With new proxy method
|
||||
`create_security_group_rules` now it's possible to create multiple rules
|
||||
for certain security group.
|
Loading…
x
Reference in New Issue
Block a user