Skip to content

Conversation

@zliang-akamai
Copy link
Member

📝 Description

Add support for resource lock API changes.

✔️ How to Test

python -m pytest test/unit/objects/lock_test.py -v

Tests that a lock with subresources can be created
"""
with self.mock_post("/locks/1") as m:
lock = self.client.locks.create(

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable lock is not used.
@zliang-akamai zliang-akamai marked this pull request as ready for review December 7, 2025 02:26
@zliang-akamai zliang-akamai requested a review from a team as a code owner December 7, 2025 02:26
@zliang-akamai zliang-akamai requested review from jriddle-linode and lgarber-akamai and removed request for a team December 7, 2025 02:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive support for resource lock functionality to the Linode API client, enabling users to prevent deletion or modification of resources (currently Linode instances).

Key Changes:

  • Introduced Lock and LockEntity data models with support for two lock types: cannot_delete and cannot_delete_with_subresources
  • Added LockGroup with methods to list, create, and delete resource locks
  • Integrated lock support into the LinodeClient and added a locks property to Linode instances

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
linode_api4/objects/lock.py Defines Lock, LockEntity, and LockType models for representing resource locks
linode_api4/groups/lock.py Implements LockGroup with create and list operations for resource locks
linode_api4/objects/init.py Exports lock-related classes for public API access
linode_api4/groups/init.py Exports LockGroup for public API access
linode_api4/linode_client.py Integrates LockGroup into LinodeClient
linode_api4/objects/linode.py Adds locks property to Instance model
test/unit/objects/lock_test.py Unit tests for Lock object methods (get, delete)
test/unit/groups/lock_test.py Unit tests for LockGroup methods (list, create with variations)
test/integration/models/lock/test_lock.py End-to-end integration tests for lock functionality
test/integration/models/lock/init.py Package initialization for lock integration tests
test/fixtures/locks_1.json Mock response fixture for single lock retrieval
test/fixtures/locks.json Mock response fixture for listing multiple locks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

Works locally!

@zliang-akamai zliang-akamai requested a review from Copilot January 7, 2026 22:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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