Skip to content

feat(ipam): allow filtering on pn, subnet or vpc id #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions scaleway-async/scaleway_async/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ async def list_i_ps(
project_id: Optional[str] = None,
zonal: Optional[str] = None,
private_network_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_id: Optional[str] = None,
resource_type: Optional[ResourceType] = None,
Expand All @@ -231,9 +233,12 @@ async def list_i_ps(
:param page_size: Maximum number of IPs to return per page.
:param project_id: Project ID to filter for. Only IPs belonging to this Project will be returned.
:param zonal: Zone to filter for. Only IPs that are zonal, and in this zone, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param private_network_id: Only IPs that are private, and in this Private Network, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param subnet_id: Only IPs inside this exact subnet will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param vpc_id: Only IPs owned by resources in this VPC will be returned.
:param attached: Defines whether to filter only for IPs which are attached to a resource.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
Expand Down Expand Up @@ -271,9 +276,11 @@ async def list_i_ps(
"resource_name": resource_name,
"resource_type": resource_type,
"tags": tags,
"vpc_id": vpc_id,
**resolve_one_of(
[
OneOfPossibility("private_network_id", private_network_id),
OneOfPossibility("subnet_id", subnet_id),
OneOfPossibility("zonal", zonal),
]
),
Expand All @@ -293,6 +300,8 @@ async def list_i_ps_all(
project_id: Optional[str] = None,
zonal: Optional[str] = None,
private_network_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_id: Optional[str] = None,
resource_type: Optional[ResourceType] = None,
Expand All @@ -311,9 +320,12 @@ async def list_i_ps_all(
:param page_size: Maximum number of IPs to return per page.
:param project_id: Project ID to filter for. Only IPs belonging to this Project will be returned.
:param zonal: Zone to filter for. Only IPs that are zonal, and in this zone, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param private_network_id: Only IPs that are private, and in this Private Network, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param subnet_id: Only IPs inside this exact subnet will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param vpc_id: Only IPs owned by resources in this VPC will be returned.
:param attached: Defines whether to filter only for IPs which are attached to a resource.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
Expand All @@ -340,6 +352,7 @@ async def list_i_ps_all(
"page": page,
"page_size": page_size,
"project_id": project_id,
"vpc_id": vpc_id,
"attached": attached,
"resource_id": resource_id,
"resource_type": resource_type,
Expand All @@ -350,5 +363,6 @@ async def list_i_ps_all(
"resource_name": resource_name,
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
},
)
7 changes: 7 additions & 0 deletions scaleway-async/scaleway_async/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ class ListIPsRequest:
Project ID to filter for. Only IPs belonging to this Project will be returned.
"""

vpc_id: Optional[str]
"""
Only IPs owned by resources in this VPC will be returned.
"""

attached: Optional[bool]
"""
Defines whether to filter only for IPs which are attached to a resource.
Expand Down Expand Up @@ -274,6 +279,8 @@ class ListIPsRequest:

private_network_id: Optional[str]

subnet_id: Optional[str]


@dataclass
class ListIPsResponse:
Expand Down
22 changes: 18 additions & 4 deletions scaleway/scaleway/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def list_i_ps(
project_id: Optional[str] = None,
zonal: Optional[str] = None,
private_network_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_id: Optional[str] = None,
resource_type: Optional[ResourceType] = None,
Expand All @@ -231,9 +233,12 @@ def list_i_ps(
:param page_size: Maximum number of IPs to return per page.
:param project_id: Project ID to filter for. Only IPs belonging to this Project will be returned.
:param zonal: Zone to filter for. Only IPs that are zonal, and in this zone, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param private_network_id: Only IPs that are private, and in this Private Network, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param subnet_id: Only IPs inside this exact subnet will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param vpc_id: Only IPs owned by resources in this VPC will be returned.
:param attached: Defines whether to filter only for IPs which are attached to a resource.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
Expand Down Expand Up @@ -271,9 +276,11 @@ def list_i_ps(
"resource_name": resource_name,
"resource_type": resource_type,
"tags": tags,
"vpc_id": vpc_id,
**resolve_one_of(
[
OneOfPossibility("private_network_id", private_network_id),
OneOfPossibility("subnet_id", subnet_id),
OneOfPossibility("zonal", zonal),
]
),
Expand All @@ -293,6 +300,8 @@ def list_i_ps_all(
project_id: Optional[str] = None,
zonal: Optional[str] = None,
private_network_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_id: Optional[str] = None,
resource_type: Optional[ResourceType] = None,
Expand All @@ -311,9 +320,12 @@ def list_i_ps_all(
:param page_size: Maximum number of IPs to return per page.
:param project_id: Project ID to filter for. Only IPs belonging to this Project will be returned.
:param zonal: Zone to filter for. Only IPs that are zonal, and in this zone, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param private_network_id: Only IPs that are private, and in this Private Network, will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param subnet_id: Only IPs inside this exact subnet will be returned.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id' could be set.
:param vpc_id: Only IPs owned by resources in this VPC will be returned.
:param attached: Defines whether to filter only for IPs which are attached to a resource.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
Expand All @@ -340,6 +352,7 @@ def list_i_ps_all(
"page": page,
"page_size": page_size,
"project_id": project_id,
"vpc_id": vpc_id,
"attached": attached,
"resource_id": resource_id,
"resource_type": resource_type,
Expand All @@ -350,5 +363,6 @@ def list_i_ps_all(
"resource_name": resource_name,
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
},
)
7 changes: 7 additions & 0 deletions scaleway/scaleway/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ class ListIPsRequest:
Project ID to filter for. Only IPs belonging to this Project will be returned.
"""

vpc_id: Optional[str]
"""
Only IPs owned by resources in this VPC will be returned.
"""

attached: Optional[bool]
"""
Defines whether to filter only for IPs which are attached to a resource.
Expand Down Expand Up @@ -274,6 +279,8 @@ class ListIPsRequest:

private_network_id: Optional[str]

subnet_id: Optional[str]


@dataclass
class ListIPsResponse:
Expand Down