Skip to content

Commit 6af928b

Browse files
authored
Add vpc_id subnet list parameter (#257)
Add `vpc_id` subnet list parameter Add support of vpc_id query parameter when listing subnets Reviewed-by: Rodion Gyrbu <fpsoff@outlook.com> Reviewed-by: Vladimir Vshivkov <None> Reviewed-by: Anton Sidelnikov <None> Reviewed-by: Polina Gubina <None> Reviewed-by: None <None>
1 parent 747044f commit 6af928b

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

otcextensions/sdk/vpc/v1/subnet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class Subnet(resource.Resource):
3232
allow_delete = True
3333
allow_list = True
3434

35+
_query_mapping = resource.QueryParameters('vpc_id')
36+
3537
# Properties
3638
project_id = resource.URI('project_id')
3739
description = resource.Body('description')

otcextensions/tests/functional/sdk/vpc/v1/test_subnet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def seed(self):
3333
def setUp(self):
3434
super().setUp()
3535

36-
self.client = self.conn.vpc
3736
attrs = {
3837
'name': 'test-vpc-' + self.seed,
3938
'cidr': '192.168.0.0/16'
@@ -98,7 +97,7 @@ def test_delete_subnet(self):
9897
def test_list_subnets(self):
9998
subnet = self._create_subnet()
10099

101-
subnets = list(self.conn.vpc.subnets())
100+
subnets = list(self.conn.vpc.subnets(vpc_id=subnet.vpc_id))
102101
self.assertGreaterEqual(len(subnets), 1)
103102

104103
self.assertIn(subnet, subnets)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
Allow passing ``vpc_id`` when listing subnets

0 commit comments

Comments
 (0)