Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions linode_api4/objects/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ class InstanceDiskEncryptionType(StrEnum):
disabled = "disabled"


class InstanceCapability(StrEnum):
"""
An enum class that represents the capabilities that a Linode instance
can support.

These capabilities indicate what features are available for a specific Linode.
"""

blockstorage_encryption = "Block Storage Encryption"
blockstorage_perf_b1 = "Block Storage Performance B1"
maintenance_policy = "Maintenance Policy"
smtp_enabled = "SMTP Enabled"

@mawilk90 mawilk90 Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm wondering if it's really necessary to extract Linode's capabilities into a separate object (and then maintain both), especially that the values here seem to be the same as in the Capability class

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current Capability class belongs to regions and reusing Capability for instances would suggest values that an instance doesn't have. Also account/region/instance could potentially have different sets of capabilities 🤔



class Backup(DerivedBase):
"""
A Backup of a Linode Instance.
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/linode_instances.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"placement_group_type": "anti_affinity:local",
"placement_group_policy": "strict"
},
"maintenance_policy" : "linode/migrate"
"maintenance_policy" : "linode/migrate",
"capabilities": ["Block Storage Encryption", "SMTP Enabled"]
},
{
"group": "test",
Expand Down
8 changes: 6 additions & 2 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
ReservedIPAddress,
Type,
)
from linode_api4.objects.linode import InstanceDiskEncryptionType, MigrationType
from linode_api4.objects.linode import (
InstanceCapability,
InstanceDiskEncryptionType,
MigrationType,
)
from linode_api4.objects.region import RegionAvailabilityEntry


Expand Down Expand Up @@ -697,7 +701,7 @@ def test_linode_with_block_storage_encryption(
linode_with_block_storage_encryption,
):
linode = linode_with_block_storage_encryption
assert Capability.blockstorage_encryption in linode.capabilities
assert InstanceCapability.blockstorage_encryption in linode.capabilities


def wait_for_disk_status(disk: Disk, timeout):
Expand Down
5 changes: 5 additions & 0 deletions test/unit/objects/linode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
)

from linode_api4 import (
InstanceCapability,
InstanceDiskEncryptionType,
InterfaceGeneration,
NetworkInterface,
Expand Down Expand Up @@ -61,6 +62,10 @@ def test_get_linode(self):
)
self.assertEqual(linode.lke_cluster_id, None)
self.assertEqual(linode.maintenance_policy, "linode/migrate")
self.assertIn(
InstanceCapability.blockstorage_encryption, linode.capabilities
)
self.assertIn(InstanceCapability.smtp_enabled, linode.capabilities)

self.assertEqual(linode.alerts.cpu, 90)
self.assertEqual(linode.alerts.io, 5000)
Expand Down