11import base64
22import os
3- from collections .abc import Iterable
43from typing import Any , Dict , List , Optional , Union
54
65from linode_api4 .common import load_and_validate_keys
76from linode_api4 .errors import UnexpectedResponseError
87from linode_api4 .groups import Group
98from 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 ,
0 commit comments