Add NodeBalancer deletion-protection locks support#881
Add NodeBalancer deletion-protection locks support#881zliang-akamai wants to merge 3 commits intolinode:mainfrom
Conversation
dawiddzhafarov
left a comment
There was a problem hiding this comment.
LGTM, tests pass locally.
There was a problem hiding this comment.
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 []LockTypeto theNodeBalancermodel. - Extend NodeBalancer unit tests to assert correct
locksunmarshalling for get/list/update. - Update NodeBalancer unit test fixtures to include the
locksfield 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. |
There was a problem hiding this comment.
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).
| // 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. |
Add NodeBalancer deletion-protection locks support (locks field + tests)
Description
Add
Locks []LockTypetoNodeBalancerto surface NodeBalancer deletion-protection locks returned by the API.How to Test
go test ./test/unit/... -v