1
1
import base64
2
2
import os
3
- from collections .abc import Iterable
4
3
from typing import Any , Dict , List , Optional , Union
5
4
6
5
from linode_api4 .common import load_and_validate_keys
7
6
from linode_api4 .errors import UnexpectedResponseError
8
7
from linode_api4 .groups import Group
9
8
from linode_api4 .objects import (
10
- ConfigInterface ,
11
9
Firewall ,
12
10
Instance ,
13
11
InstanceDiskEncryptionType ,
14
12
InterfaceGeneration ,
15
13
Kernel ,
16
- LinodeInterface ,
14
+ LinodeInterfaceOptions ,
17
15
NetworkInterface ,
18
16
PlacementGroup ,
19
17
StackScript ,
@@ -157,7 +155,9 @@ def instance_create(
157
155
]
158
156
] = None ,
159
157
interfaces : Optional [
160
- List [Union [LinodeInterface , NetworkInterface , Dict [str , Any ]],]
158
+ List [
159
+ Union [LinodeInterfaceOptions , NetworkInterface , Dict [str , Any ]],
160
+ ]
161
161
] = None ,
162
162
interface_generation : Optional [Union [InterfaceGeneration , str ]] = None ,
163
163
network_helper : Optional [bool ] = None ,
@@ -301,11 +301,9 @@ def instance_create(
301
301
:type disk_encryption: InstanceDiskEncryptionType or str
302
302
:param interfaces: An array of Network Interfaces to add to this Linode’s Configuration Profile.
303
303
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]]
305
305
:param placement_group: A Placement Group to create this Linode under.
306
306
: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]
309
307
:param interface_generation: The generation of network interfaces this Linode uses.
310
308
:type interface_generation: InterfaceGeneration or str
311
309
:param network_helper: Whether this instance should have Network Helper enabled.
@@ -325,13 +323,6 @@ def instance_create(
325
323
ret_pass = Instance .generate_root_password ()
326
324
kwargs ["root_pass" ] = ret_pass
327
325
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
-
335
326
params = {
336
327
"type" : ltype ,
337
328
"region" : region ,
0 commit comments