Skip to content

Commit 24aad98

Browse files
oops
1 parent 9a1b547 commit 24aad98

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

linode_api4/groups/linode.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import base64
22
import os
3-
from collections.abc import Iterable
43
from typing import Any, Dict, List, Optional, Union
54

65
from linode_api4.common import load_and_validate_keys
76
from linode_api4.errors import UnexpectedResponseError
87
from linode_api4.groups import Group
98
from linode_api4.objects import (
10-
ConfigInterface,
119
Firewall,
1210
Instance,
1311
InstanceDiskEncryptionType,
1412
InterfaceGeneration,
1513
Kernel,
16-
LinodeInterface,
14+
LinodeInterfaceOptions,
1715
NetworkInterface,
1816
PlacementGroup,
1917
StackScript,
@@ -157,7 +155,9 @@ def instance_create(
157155
]
158156
] = None,
159157
interfaces: Optional[
160-
List[Union[LinodeInterface, NetworkInterface, Dict[str, Any]],]
158+
List[
159+
Union[LinodeInterfaceOptions, NetworkInterface, Dict[str, Any]],
160+
]
161161
] = None,
162162
interface_generation: Optional[Union[InterfaceGeneration, str]] = None,
163163
network_helper: Optional[bool] = None,
@@ -301,11 +301,9 @@ def instance_create(
301301
:type disk_encryption: InstanceDiskEncryptionType or str
302302
:param interfaces: An array of Network Interfaces to add to this Linode’s Configuration Profile.
303303
At least one and up to three Interface objects can exist in this array.
304-
:type interfaces: list[ConfigInterface] or list[dict[str, Any]]
304+
:type interfaces: List[LinodeInterfaceOptions], List[NetworkInterface], or List[dict[str, Any]]
305305
:param placement_group: A Placement Group to create this Linode under.
306306
:type placement_group: Union[InstancePlacementGroupAssignment, PlacementGroup, Dict[str, Any], int]
307-
:param interfaces: The interfaces to create this Linode with.
308-
:type interfaces: List of LinodeInterface, NetworkInterface (deprecated), or Dict[str, Any]
309307
:param interface_generation: The generation of network interfaces this Linode uses.
310308
:type interface_generation: InterfaceGeneration or str
311309
:param network_helper: Whether this instance should have Network Helper enabled.
@@ -325,13 +323,6 @@ def instance_create(
325323
ret_pass = Instance.generate_root_password()
326324
kwargs["root_pass"] = ret_pass
327325

328-
interfaces = kwargs.get("interfaces", None)
329-
if interfaces is not None and isinstance(interfaces, Iterable):
330-
kwargs["interfaces"] = [
331-
i._serialize() if isinstance(i, ConfigInterface) else i
332-
for i in interfaces
333-
]
334-
335326
params = {
336327
"type": ltype,
337328
"region": region,

linode_api4/objects/linode_interfaces.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ class LinodeInterfaceVLANOptions(JSONObject):
101101
ipam_address: Optional[str] = None
102102

103103

104+
@dataclass
105+
class LinodeInterfaceOptions(JSONObject):
106+
firewall_id: Optional[int] = None
107+
default_route: Optional[LinodeInterfaceDefaultRouteOptions] = None
108+
vpc: Optional[LinodeInterfaceVPCOptions] = None
109+
public: Optional[LinodeInterfacePublicOptions] = None
110+
vlan: Optional[LinodeInterfaceVLANOptions] = None
111+
112+
104113
# Interface PUT Options
105114
# NOTE: These classes currently match their POST equivalents
106115
# but are implemented separately for future-proofing.

0 commit comments

Comments
 (0)