Skip to content

Commit 982d27a

Browse files
Support interface_generation
1 parent 21d6fc8 commit 982d27a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

linode_api4/groups/linode.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Firewall,
1212
Instance,
1313
InstanceDiskEncryptionType,
14+
InterfaceGeneration,
1415
Kernel,
1516
PlacementGroup,
1617
StackScript,
@@ -153,7 +154,8 @@ def instance_create(
153154
int,
154155
]
155156
] = None,
156-
# TODO(Enhanced Interfaces): Add related fields
157+
interface_generation: Optional[Union[InterfaceGeneration, str]] = None,
158+
network_helper: Optional[bool] = None,
157159
**kwargs,
158160
):
159161
"""
@@ -297,6 +299,10 @@ def instance_create(
297299
:type interfaces: list[ConfigInterface] or list[dict[str, Any]]
298300
:param placement_group: A Placement Group to create this Linode under.
299301
:type placement_group: Union[InstancePlacementGroupAssignment, PlacementGroup, Dict[str, Any], int]
302+
:param interface_generation: The generation of network interfaces this Linode uses.
303+
:type interface_generation: InterfaceGeneration or str
304+
:param network_helper: Whether this instance should have Network Helper enabled.
305+
:type network_helper: bool
300306
301307
:returns: A new Instance object, or a tuple containing the new Instance and
302308
the generated password.
@@ -337,6 +343,8 @@ def instance_create(
337343
if placement_group
338344
else None
339345
),
346+
"interface_generaiton": interface_generation,
347+
"network_helper": network_helper,
340348
}
341349

342350
params.update(kwargs)

linode_api4/objects/linode.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ class Config(DerivedBase):
468468
"virt_mode": Property(mutable=True),
469469
"memory_limit": Property(mutable=True),
470470
"interfaces": Property(mutable=True, json_object=ConfigInterface),
471+
"interface_generation": Property(),
471472
}
472473

473474
@property
@@ -661,6 +662,11 @@ class MigrationType:
661662
WARM = "warm"
662663

663664

665+
class InterfaceGeneration(StrEnum):
666+
LEGACY_CONFIG = "legacy_config"
667+
LINODE = "linode"
668+
669+
664670
@dataclass
665671
class UpgradeInterfacesResult(JSONObject):
666672
dry_run: bool = False
@@ -1919,6 +1925,8 @@ def upgrade_interfaces(
19191925
data=_flatten_request_body_recursive(drop_null_keys(params)),
19201926
)
19211927

1928+
self.invalidate()
1929+
19221930
# We don't convert interface dicts to LinodeInterface objects on dry runs
19231931
# actual API entities aren't created
19241932
if dry_run:

0 commit comments

Comments
 (0)