Skip to content

Commit 114183d

Browse files
authored
docs(ipam): document expected format of requested IP (#514)
1 parent 89e0dc9 commit 114183d

File tree

6 files changed

+46
-6
lines changed

6 files changed

+46
-6
lines changed

scaleway-async/scaleway_async/ipam/v1/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def book_ip(
5353
:param is_ipv6: Request an IPv6 instead of an IPv4.
5454
:param region: Region to target. If none is passed will use default region from the config.
5555
:param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project.
56-
: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.
56+
: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.
5757
:param tags: Tags for the IP.
5858
:return: :class:`IP <IP>`
5959

scaleway-async/scaleway_async/ipam/v1/marshalling.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def unmarshal_Resource(data: Any) -> Resource:
2828

2929
args: Dict[str, Any] = {}
3030

31-
field = data.get("type_", None)
31+
field = data.get("type", None)
3232
if field is not None:
3333
args["type_"] = field
3434

@@ -39,10 +39,14 @@ def unmarshal_Resource(data: Any) -> Resource:
3939
field = data.get("mac_address", None)
4040
if field is not None:
4141
args["mac_address"] = field
42+
else:
43+
args["mac_address"] = None
4244

4345
field = data.get("name", None)
4446
if field is not None:
4547
args["name"] = field
48+
else:
49+
args["name"] = None
4650

4751
return Resource(**args)
4852

@@ -62,6 +66,8 @@ def unmarshal_Reverse(data: Any) -> Reverse:
6266
field = data.get("address", None)
6367
if field is not None:
6468
args["address"] = field
69+
else:
70+
args["address"] = None
6571

6672
return Reverse(**args)
6773

@@ -77,14 +83,20 @@ def unmarshal_Source(data: Any) -> Source:
7783
field = data.get("zonal", None)
7884
if field is not None:
7985
args["zonal"] = field
86+
else:
87+
args["zonal"] = None
8088

8189
field = data.get("private_network_id", None)
8290
if field is not None:
8391
args["private_network_id"] = field
92+
else:
93+
args["private_network_id"] = None
8494

8595
field = data.get("subnet_id", None)
8696
if field is not None:
8797
args["subnet_id"] = field
98+
else:
99+
args["subnet_id"] = None
88100

89101
return Source(**args)
90102

@@ -134,18 +146,26 @@ def unmarshal_IP(data: Any) -> IP:
134146
field = data.get("created_at", None)
135147
if field is not None:
136148
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
149+
else:
150+
args["created_at"] = None
137151

138152
field = data.get("updated_at", None)
139153
if field is not None:
140154
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
155+
else:
156+
args["updated_at"] = None
141157

142158
field = data.get("resource", None)
143159
if field is not None:
144160
args["resource"] = unmarshal_Resource(field)
161+
else:
162+
args["resource"] = None
145163

146164
field = data.get("zone", None)
147165
if field is not None:
148166
args["zone"] = field
167+
else:
168+
args["zone"] = None
149169

150170
return IP(**args)
151171

scaleway-async/scaleway_async/ipam/v1/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class BookIPRequest:
181181

182182
address: Optional[str]
183183
"""
184-
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.
184+
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.
185185
"""
186186

187187
tags: Optional[List[str]]

scaleway/scaleway/ipam/v1/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def book_ip(
5353
:param is_ipv6: Request an IPv6 instead of an IPv4.
5454
:param region: Region to target. If none is passed will use default region from the config.
5555
:param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project.
56-
: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.
56+
: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.
5757
:param tags: Tags for the IP.
5858
:return: :class:`IP <IP>`
5959

scaleway/scaleway/ipam/v1/marshalling.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def unmarshal_Resource(data: Any) -> Resource:
2828

2929
args: Dict[str, Any] = {}
3030

31-
field = data.get("type_", None)
31+
field = data.get("type", None)
3232
if field is not None:
3333
args["type_"] = field
3434

@@ -39,10 +39,14 @@ def unmarshal_Resource(data: Any) -> Resource:
3939
field = data.get("mac_address", None)
4040
if field is not None:
4141
args["mac_address"] = field
42+
else:
43+
args["mac_address"] = None
4244

4345
field = data.get("name", None)
4446
if field is not None:
4547
args["name"] = field
48+
else:
49+
args["name"] = None
4650

4751
return Resource(**args)
4852

@@ -62,6 +66,8 @@ def unmarshal_Reverse(data: Any) -> Reverse:
6266
field = data.get("address", None)
6367
if field is not None:
6468
args["address"] = field
69+
else:
70+
args["address"] = None
6571

6672
return Reverse(**args)
6773

@@ -77,14 +83,20 @@ def unmarshal_Source(data: Any) -> Source:
7783
field = data.get("zonal", None)
7884
if field is not None:
7985
args["zonal"] = field
86+
else:
87+
args["zonal"] = None
8088

8189
field = data.get("private_network_id", None)
8290
if field is not None:
8391
args["private_network_id"] = field
92+
else:
93+
args["private_network_id"] = None
8494

8595
field = data.get("subnet_id", None)
8696
if field is not None:
8797
args["subnet_id"] = field
98+
else:
99+
args["subnet_id"] = None
88100

89101
return Source(**args)
90102

@@ -134,18 +146,26 @@ def unmarshal_IP(data: Any) -> IP:
134146
field = data.get("created_at", None)
135147
if field is not None:
136148
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
149+
else:
150+
args["created_at"] = None
137151

138152
field = data.get("updated_at", None)
139153
if field is not None:
140154
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
155+
else:
156+
args["updated_at"] = None
141157

142158
field = data.get("resource", None)
143159
if field is not None:
144160
args["resource"] = unmarshal_Resource(field)
161+
else:
162+
args["resource"] = None
145163

146164
field = data.get("zone", None)
147165
if field is not None:
148166
args["zone"] = field
167+
else:
168+
args["zone"] = None
149169

150170
return IP(**args)
151171

scaleway/scaleway/ipam/v1/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class BookIPRequest:
181181

182182
address: Optional[str]
183183
"""
184-
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.
184+
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.
185185
"""
186186

187187
tags: Optional[List[str]]

0 commit comments

Comments
 (0)