Skip to content

feat(ipam): add new ip source #1000

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
Jun 2, 2025
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
20 changes: 14 additions & 6 deletions scaleway-async/scaleway_async/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ async def list_i_ps(
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
ip_ids: Optional[List[str]] = None,
source_vpc_id: Optional[str] = None,
) -> ListIPsResponse:
"""
List existing IPs.
Expand All @@ -282,11 +283,11 @@ 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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
Expand All @@ -299,6 +300,8 @@ async def list_i_ps(
: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 ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:param source_vpc_id:
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_id' could be set.
:return: :class:`ListIPsResponse <ListIPsResponse>`

Usage:
Expand Down Expand Up @@ -335,6 +338,7 @@ async def list_i_ps(
**resolve_one_of(
[
OneOfPossibility("private_network_id", private_network_id),
OneOfPossibility("source_vpc_id", source_vpc_id),
OneOfPossibility("subnet_id", subnet_id),
OneOfPossibility("zonal", zonal),
]
Expand Down Expand Up @@ -368,6 +372,7 @@ async def list_i_ps_all(
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
ip_ids: Optional[List[str]] = None,
source_vpc_id: Optional[str] = None,
) -> List[IP]:
"""
List existing IPs.
Expand All @@ -378,11 +383,11 @@ 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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
Expand All @@ -395,6 +400,8 @@ async def list_i_ps_all(
: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 ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:param source_vpc_id:
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_id' could be set.
:return: :class:`List[IP] <List[IP]>`

Usage:
Expand Down Expand Up @@ -428,6 +435,7 @@ async def list_i_ps_all(
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
"source_vpc_id": source_vpc_id,
},
)

Expand Down
7 changes: 7 additions & 0 deletions scaleway-async/scaleway_async/ipam/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def unmarshal_Source(data: Any) -> Source:
else:
args["subnet_id"] = None

field = data.get("vpc_id", None)
if field is not None:
args["vpc_id"] = field
else:
args["vpc_id"] = None

return Source(**args)


Expand Down Expand Up @@ -234,6 +240,7 @@ def marshal_Source(
OneOfPossibility("zonal", request.zonal),
OneOfPossibility("private_network_id", request.private_network_id),
OneOfPossibility("subnet_id", request.subnet_id),
OneOfPossibility("vpc_id", request.vpc_id),
]
),
)
Expand Down
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class Source:

subnet_id: Optional[str]

vpc_id: Optional[str]


@dataclass
class CustomResource:
Expand Down Expand Up @@ -358,6 +360,8 @@ class ListIPsRequest:

subnet_id: Optional[str]

source_vpc_id: Optional[str]


@dataclass
class ListIPsResponse:
Expand Down
20 changes: 14 additions & 6 deletions scaleway/scaleway/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def list_i_ps(
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
ip_ids: Optional[List[str]] = None,
source_vpc_id: Optional[str] = None,
) -> ListIPsResponse:
"""
List existing IPs.
Expand All @@ -282,11 +283,11 @@ 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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
Expand All @@ -299,6 +300,8 @@ def list_i_ps(
: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 ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:param source_vpc_id:
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_id' could be set.
:return: :class:`ListIPsResponse <ListIPsResponse>`

Usage:
Expand Down Expand Up @@ -335,6 +338,7 @@ def list_i_ps(
**resolve_one_of(
[
OneOfPossibility("private_network_id", private_network_id),
OneOfPossibility("source_vpc_id", source_vpc_id),
OneOfPossibility("subnet_id", subnet_id),
OneOfPossibility("zonal", zonal),
]
Expand Down Expand Up @@ -368,6 +372,7 @@ def list_i_ps_all(
organization_id: Optional[str] = None,
is_ipv6: Optional[bool] = None,
ip_ids: Optional[List[str]] = None,
source_vpc_id: Optional[str] = None,
) -> List[IP]:
"""
List existing IPs.
Expand All @@ -378,11 +383,11 @@ 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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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', 'subnet_id' could be set.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_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.
Expand All @@ -395,6 +400,8 @@ def list_i_ps_all(
: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 ip_ids: IP IDs to filter for. Only IPs with these UUIDs will be returned.
:param source_vpc_id:
One-Of ('source'): at most one of 'zonal', 'private_network_id', 'subnet_id', 'source_vpc_id' could be set.
:return: :class:`List[IP] <List[IP]>`

Usage:
Expand Down Expand Up @@ -428,6 +435,7 @@ def list_i_ps_all(
"zonal": zonal,
"private_network_id": private_network_id,
"subnet_id": subnet_id,
"source_vpc_id": source_vpc_id,
},
)

Expand Down
7 changes: 7 additions & 0 deletions scaleway/scaleway/ipam/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def unmarshal_Source(data: Any) -> Source:
else:
args["subnet_id"] = None

field = data.get("vpc_id", None)
if field is not None:
args["vpc_id"] = field
else:
args["vpc_id"] = None

return Source(**args)


Expand Down Expand Up @@ -234,6 +240,7 @@ def marshal_Source(
OneOfPossibility("zonal", request.zonal),
OneOfPossibility("private_network_id", request.private_network_id),
OneOfPossibility("subnet_id", request.subnet_id),
OneOfPossibility("vpc_id", request.vpc_id),
]
),
)
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class Source:

subnet_id: Optional[str]

vpc_id: Optional[str]


@dataclass
class CustomResource:
Expand Down Expand Up @@ -358,6 +360,8 @@ class ListIPsRequest:

subnet_id: Optional[str]

source_vpc_id: Optional[str]


@dataclass
class ListIPsResponse:
Expand Down