Skip to content

docs(ipam): document expected format of requested IP #514

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 1 commit into from
May 3, 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
2 changes: 1 addition & 1 deletion scaleway-async/scaleway_async/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def book_ip(
:param is_ipv6: Request an IPv6 instead of an IPv4.
:param region: Region to target. If none is passed will use default region from the config.
:param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project.
:param address: Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
:param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
:param tags: Tags for the IP.
:return: :class:`IP <IP>`

Expand Down
22 changes: 21 additions & 1 deletion scaleway-async/scaleway_async/ipam/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def unmarshal_Resource(data: Any) -> Resource:

args: Dict[str, Any] = {}

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

Expand All @@ -39,10 +39,14 @@ def unmarshal_Resource(data: Any) -> Resource:
field = data.get("mac_address", None)
if field is not None:
args["mac_address"] = field
else:
args["mac_address"] = None

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

return Resource(**args)

Expand All @@ -62,6 +66,8 @@ def unmarshal_Reverse(data: Any) -> Reverse:
field = data.get("address", None)
if field is not None:
args["address"] = field
else:
args["address"] = None

return Reverse(**args)

Expand All @@ -77,14 +83,20 @@ def unmarshal_Source(data: Any) -> Source:
field = data.get("zonal", None)
if field is not None:
args["zonal"] = field
else:
args["zonal"] = None

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

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

return Source(**args)

Expand Down Expand Up @@ -134,18 +146,26 @@ def unmarshal_IP(data: Any) -> IP:
field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

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

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

return IP(**args)

Expand Down
2 changes: 1 addition & 1 deletion scaleway-async/scaleway_async/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class BookIPRequest:

address: Optional[str]
"""
Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
"""

tags: Optional[List[str]]
Expand Down
2 changes: 1 addition & 1 deletion scaleway/scaleway/ipam/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def book_ip(
:param is_ipv6: Request an IPv6 instead of an IPv4.
:param region: Region to target. If none is passed will use default region from the config.
:param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project.
:param address: Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
:param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
:param tags: Tags for the IP.
:return: :class:`IP <IP>`

Expand Down
22 changes: 21 additions & 1 deletion scaleway/scaleway/ipam/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def unmarshal_Resource(data: Any) -> Resource:

args: Dict[str, Any] = {}

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

Expand All @@ -39,10 +39,14 @@ def unmarshal_Resource(data: Any) -> Resource:
field = data.get("mac_address", None)
if field is not None:
args["mac_address"] = field
else:
args["mac_address"] = None

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

return Resource(**args)

Expand All @@ -62,6 +66,8 @@ def unmarshal_Reverse(data: Any) -> Reverse:
field = data.get("address", None)
if field is not None:
args["address"] = field
else:
args["address"] = None

return Reverse(**args)

Expand All @@ -77,14 +83,20 @@ def unmarshal_Source(data: Any) -> Source:
field = data.get("zonal", None)
if field is not None:
args["zonal"] = field
else:
args["zonal"] = None

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

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

return Source(**args)

Expand Down Expand Up @@ -134,18 +146,26 @@ def unmarshal_IP(data: Any) -> IP:
field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

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

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

return IP(**args)

Expand Down
2 changes: 1 addition & 1 deletion scaleway/scaleway/ipam/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class BookIPRequest:

address: Optional[str]
"""
Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
"""

tags: Optional[List[str]]
Expand Down