Skip to content

Commit

Permalink
feat(ipam): support filtering ips on ids (scaleway#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Dec 11, 2024
1 parent 75f362b commit fac0156
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 34 deletions.
26 changes: 16 additions & 10 deletions scaleway-async/scaleway_async/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,16 @@ async def list_i_ps(
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_id: Optional[str] = None,
resource_ids: Optional[List[str]] = None,
resource_type: Optional[ResourceType] = None,
resource_types: Optional[List[ResourceType]] = None,
mac_address: Optional[str] = None,
tags: Optional[List[str]] = None,
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_types: Optional[List[ResourceType]] = None,
ip_ids: Optional[List[str]] = None,
) -> ListIPsResponse:
"""
List existing IPs.
Expand All @@ -288,15 +289,16 @@ async def list_i_ps(
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_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_ids: Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param mac_address: MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
:param tags: Tags to filter for, only IPs with one or more matching tags will be returned.
:param organization_id: Organization ID to filter for. Only IPs belonging to this Organization will be returned.
:param is_ipv6: Defines whether to filter only for IPv4s or IPv6s.
:param resource_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:return: :class:`ListIPsResponse <ListIPsResponse>`
Usage:
Expand All @@ -314,6 +316,7 @@ async def list_i_ps(
f"/ipam/v1/regions/{param_region}/ips",
params={
"attached": attached,
"ip_ids": ip_ids,
"is_ipv6": is_ipv6,
"mac_address": mac_address,
"order_by": order_by,
Expand Down Expand Up @@ -355,15 +358,16 @@ async def list_i_ps_all(
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_id: Optional[str] = None,
resource_ids: Optional[List[str]] = None,
resource_type: Optional[ResourceType] = None,
resource_types: Optional[List[ResourceType]] = None,
mac_address: Optional[str] = None,
tags: Optional[List[str]] = None,
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_types: Optional[List[ResourceType]] = None,
ip_ids: Optional[List[str]] = None,
) -> List[IP]:
"""
List existing IPs.
Expand All @@ -381,15 +385,16 @@ async def list_i_ps_all(
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_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_ids: Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param mac_address: MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
:param tags: Tags to filter for, only IPs with one or more matching tags will be returned.
:param organization_id: Organization ID to filter for. Only IPs belonging to this Organization will be returned.
:param is_ipv6: Defines whether to filter only for IPv4s or IPv6s.
:param resource_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:return: :class:`List[IP] <List[IP]>`
Usage:
Expand All @@ -410,15 +415,16 @@ async def list_i_ps_all(
"project_id": project_id,
"vpc_id": vpc_id,
"attached": attached,
"resource_name": resource_name,
"resource_id": resource_id,
"resource_ids": resource_ids,
"resource_type": resource_type,
"resource_types": resource_types,
"mac_address": mac_address,
"tags": tags,
"organization_id": organization_id,
"is_ipv6": is_ipv6,
"resource_name": resource_name,
"resource_types": resource_types,
"ip_ids": ip_ids,
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
Expand Down
19 changes: 12 additions & 7 deletions scaleway-async/scaleway_async/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ class ListIPsRequest:
Defines whether to filter only for IPs which are attached to a resource.
"""

resource_name: Optional[str]
"""
Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
"""

resource_id: Optional[str]
"""
Resource ID to filter for. Only IPs attached to this resource will be returned.
Expand All @@ -313,6 +318,11 @@ class ListIPsRequest:
Resource type to filter for. Only IPs attached to this type of resource will be returned.
"""

resource_types: Optional[List[ResourceType]]
"""
Resource types to filter for. Only IPs attached to these types of resources will be returned.
"""

mac_address: Optional[str]
"""
MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
Expand All @@ -333,14 +343,9 @@ class ListIPsRequest:
Defines whether to filter only for IPv4s or IPv6s.
"""

resource_name: Optional[str]
"""
Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
"""

resource_types: Optional[List[ResourceType]]
ip_ids: Optional[List[str]]
"""
Resource types to filter for. Only IPs attached to these types of resources will be returned.
IP IDs to filter for. Only IPs with these UUIDs will be returned.
"""

zonal: Optional[str]
Expand Down
26 changes: 16 additions & 10 deletions scaleway/scaleway/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,16 @@ def list_i_ps(
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_id: Optional[str] = None,
resource_ids: Optional[List[str]] = None,
resource_type: Optional[ResourceType] = None,
resource_types: Optional[List[ResourceType]] = None,
mac_address: Optional[str] = None,
tags: Optional[List[str]] = None,
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_types: Optional[List[ResourceType]] = None,
ip_ids: Optional[List[str]] = None,
) -> ListIPsResponse:
"""
List existing IPs.
Expand All @@ -288,15 +289,16 @@ def list_i_ps(
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_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_ids: Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param mac_address: MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
:param tags: Tags to filter for, only IPs with one or more matching tags will be returned.
:param organization_id: Organization ID to filter for. Only IPs belonging to this Organization will be returned.
:param is_ipv6: Defines whether to filter only for IPv4s or IPv6s.
:param resource_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:return: :class:`ListIPsResponse <ListIPsResponse>`
Usage:
Expand All @@ -314,6 +316,7 @@ def list_i_ps(
f"/ipam/v1/regions/{param_region}/ips",
params={
"attached": attached,
"ip_ids": ip_ids,
"is_ipv6": is_ipv6,
"mac_address": mac_address,
"order_by": order_by,
Expand Down Expand Up @@ -355,15 +358,16 @@ def list_i_ps_all(
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
attached: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_id: Optional[str] = None,
resource_ids: Optional[List[str]] = None,
resource_type: Optional[ResourceType] = None,
resource_types: Optional[List[ResourceType]] = None,
mac_address: Optional[str] = None,
tags: Optional[List[str]] = None,
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
resource_name: Optional[str] = None,
resource_types: Optional[List[ResourceType]] = None,
ip_ids: Optional[List[str]] = None,
) -> List[IP]:
"""
List existing IPs.
Expand All @@ -381,15 +385,16 @@ def list_i_ps_all(
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_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_id: Resource ID to filter for. Only IPs attached to this resource will be returned.
:param resource_ids: Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned.
:param resource_type: Resource type to filter for. Only IPs attached to this type of resource will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param mac_address: MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
:param tags: Tags to filter for, only IPs with one or more matching tags will be returned.
:param organization_id: Organization ID to filter for. Only IPs belonging to this Organization will be returned.
:param is_ipv6: Defines whether to filter only for IPv4s or IPv6s.
:param resource_name: Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
:param resource_types: Resource types to filter for. Only IPs attached to these types of resources will be returned.
:param ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:return: :class:`List[IP] <List[IP]>`
Usage:
Expand All @@ -410,15 +415,16 @@ def list_i_ps_all(
"project_id": project_id,
"vpc_id": vpc_id,
"attached": attached,
"resource_name": resource_name,
"resource_id": resource_id,
"resource_ids": resource_ids,
"resource_type": resource_type,
"resource_types": resource_types,
"mac_address": mac_address,
"tags": tags,
"organization_id": organization_id,
"is_ipv6": is_ipv6,
"resource_name": resource_name,
"resource_types": resource_types,
"ip_ids": ip_ids,
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
Expand Down
19 changes: 12 additions & 7 deletions scaleway/scaleway/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ class ListIPsRequest:
Defines whether to filter only for IPs which are attached to a resource.
"""

resource_name: Optional[str]
"""
Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
"""

resource_id: Optional[str]
"""
Resource ID to filter for. Only IPs attached to this resource will be returned.
Expand All @@ -313,6 +318,11 @@ class ListIPsRequest:
Resource type to filter for. Only IPs attached to this type of resource will be returned.
"""

resource_types: Optional[List[ResourceType]]
"""
Resource types to filter for. Only IPs attached to these types of resources will be returned.
"""

mac_address: Optional[str]
"""
MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
Expand All @@ -333,14 +343,9 @@ class ListIPsRequest:
Defines whether to filter only for IPv4s or IPv6s.
"""

resource_name: Optional[str]
"""
Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
"""

resource_types: Optional[List[ResourceType]]
ip_ids: Optional[List[str]]
"""
Resource types to filter for. Only IPs attached to these types of resources will be returned.
IP IDs to filter for. Only IPs with these UUIDs will be returned.
"""

zonal: Optional[str]
Expand Down

0 comments on commit fac0156

Please sign in to comment.