Skip to content

TPT-3313: Add InstanceCapability enum - #764

Open
ssastrau wants to merge 1 commit into
linode:devfrom
ssastrau:add-capabilities
Open

ssastrau wants to merge 1 commit into
linode:devfrom
ssastrau:add-capabilities

Conversation

@ssastrau

@ssastrau ssastrau commented Nov 26, 2026 •

Copy link
Copy Markdown

📝 Description

Adds an InstanceCapability enum for the values returned in Instance.capabilities
(Block Storage Encryption, Block Storage Performance B1, Maintenance Policy, SMTP Enabled).

Region capabilities are already covered by the existing Capability enum (#644), so no changes were needed there.
Instance.capabilities still returns plain strings, so this change is not breaking.

✔️ How to Test

make test-unit
python -m pytest test/integration/models/linode/test_linode.py -k test_linode_with_block_storage_encryption

@ssastrau ssastrau self-assigned this Nov 26, 2026
@ssastrau
ssastrau requested review from a team as code owners November 26, 2026 10:56
@ssastrau
ssastrau requested review from josephcardillo-akamai and psnoch-akamai and a balanced review from Copilot and removed request for a team November 26, 2026 10:56

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues block the addition of instance-specific capability constants.

No open issues 🎉

What changed in this PR

Adds InstanceCapability to the SDK, providing named constants for instance capabilities while preserving plain-string responses. Region capabilities remain covered by the existing Capability enum.

Changes:

  • Defines four instance capability values in a new StrEnum.
  • Adds fixture data and unit assertions for capability membership.
  • Updates the block storage encryption integration test to use the instance-specific enum.
File Description
test/​unit/​objects/​linode_test.py Checks enum membership against instance capability strings.
test/​integration/​models/​linode/​test_linode.py Uses InstanceCapability for the encryption assertion.
test/​fixtures/​linode_instances.json Adds sample instance capabilities.
linode_api4/​objects/​linode.py Defines the InstanceCapability enum.

Review effort: Balanced

@ssastrau ssastrau changed the title TPT-3313: Added InstanceCapability StrEnum TPT-3313: Added InstanceCapability Nov 26, 2026
@ssastrau ssastrau changed the title TPT-3313: Added InstanceCapability TPT-3313: Add InstanceCapability enum Nov 26, 2026
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 🤔

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants