Skip to content

Add NodeBalancer deletion-protection locks support#881

Open
zliang-akamai wants to merge 3 commits intolinode:mainfrom
zliang-akamai:zhiwei/nb-lock
Open

Add NodeBalancer deletion-protection locks support#881
zliang-akamai wants to merge 3 commits intolinode:mainfrom
zliang-akamai:zhiwei/nb-lock

Conversation

@zliang-akamai
Copy link
Member

Add NodeBalancer deletion-protection locks support (locks field + tests)

Description

Add Locks []LockType to NodeBalancer to surface NodeBalancer deletion-protection locks returned by the API.

How to Test

  • Run unit tests:
go test ./test/unit/... -v

@zliang-akamai zliang-akamai requested a review from a team as a code owner February 2, 2026 17:40
@zliang-akamai zliang-akamai requested review from Copilot, dawiddzhafarov and mgwoj and removed request for a team and Copilot February 2, 2026 17:40
@zliang-akamai zliang-akamai changed the title Add NodeBalancer deletion-protection locks support (locks field + tests) Add NodeBalancer deletion-protection locks support Feb 2, 2026
Copy link
Contributor

@dawiddzhafarov dawiddzhafarov left a comment

Choose a reason for hiding this comment

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

LGTM, tests pass locally.

Copilot AI review requested due to automatic review settings February 17, 2026 14:50
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

Adds support for surfacing NodeBalancer deletion-protection locks returned by the Linode API by introducing a Locks []LockType field on NodeBalancer, along with unit test and fixture updates to validate parsing.

Changes:

  • Add Locks []LockType to the NodeBalancer model.
  • Extend NodeBalancer unit tests to assert correct locks unmarshalling for get/list/update.
  • Update NodeBalancer unit test fixtures to include the locks field in API responses.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
nodebalancer.go Adds Locks []LockType to the NodeBalancer struct so API lock data is exposed to consumers.
test/unit/nodebalancer_test.go Adds assertions ensuring locks is parsed correctly across get/list/update flows.
test/unit/fixtures/nodebalancers_list.json Adds locks values to list fixture to validate both populated and empty cases.
test/unit/fixtures/nodebalancers_create_udp.json Adds empty locks array to create UDP fixture to reflect API response shape.
test/unit/fixtures/nodebalancer_update.json Adds locks field to update fixture for unmarshalling coverage.
test/unit/fixtures/nodebalancer_get.json Adds locks field to get fixture for unmarshalling coverage.
test/unit/fixtures/nodebalancer_create_with_ipv4.json Adds empty locks array to create-with-IPv4 fixture.
test/unit/fixtures/nodebalancer_create.json Adds empty locks array to create fixture.

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

Tags []string `json:"tags"`

// An array of locks applied to this NodeBalancer for deletion protection.
// Locks prevent the NodeBalancer or its subresources from being deleted.
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

LockType / Locks are documented elsewhere as v4beta-only (e.g., locks.go and the Instance.Locks field comment). For consistency and to avoid implying this is always available in v4 stable, consider adding a NOTE: Locks can only be used with v4beta. comment here as well (or otherwise clarifying availability).

Suggested change
// Locks prevent the NodeBalancer or its subresources from being deleted.
// Locks prevent the NodeBalancer or its subresources from being deleted.
// NOTE: Locks can only be used with v4beta.

Copilot uses AI. Check for mistakes.
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.

2 participants

Comments