Skip to content

Commit bce5e94

Browse files
authored
fix: assignee_type is required when creating a primary ip (#409)
The `assignee_type` is always required when creating a primary IP, also when creating an IP in a datacenter (without `assignee_id`).
1 parent 6d33c3c commit bce5e94

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

hcloud/primary_ips/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ def create(
211211
data: dict[str, Any] = {
212212
"name": name,
213213
"type": type,
214+
"assignee_type": assignee_type,
214215
"auto_delete": auto_delete,
215216
}
216217
if datacenter is not None:
217218
data["datacenter"] = datacenter.id_or_name
218219
if assignee_id is not None:
219-
data["assignee_type"] = assignee_type
220220
data["assignee_id"] = assignee_id
221221
if labels is not None:
222222
data["labels"] = labels

tests/unit/primary_ips/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_create_with_datacenter(self, primary_ips_client, primary_ip_response):
158158
json={
159159
"name": "my-resource",
160160
"type": "ipv6",
161+
"assignee_type": "server",
161162
"datacenter": "datacenter",
162163
"auto_delete": False,
163164
},

0 commit comments

Comments
 (0)