Skip to content

Commit c47e477

Browse files
committed
feat: add locks field to various resources
1 parent b0f235e commit c47e477

14 files changed

Lines changed: 41 additions & 14 deletions

instances.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type Instance struct {
7575
InterfaceGeneration InterfaceGeneration `json:"interface_generation"`
7676
MaintenancePolicy string `json:"maintenance_policy"`
7777

78-
// NOTE: Locks can only be used with v4beta.
78+
// NOTE: Both cannot_delete and cannot_delete_with_subresources apply to Instances and can only be used with v4beta.
7979
Locks []LockType `json:"locks"`
8080
}
8181

lke_clusters.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ const (
2727

2828
// LKECluster represents a LKECluster object
2929
type LKECluster struct {
30-
ID int `json:"id"`
31-
Created *time.Time `json:"-"`
32-
Updated *time.Time `json:"-"`
33-
Label string `json:"label"`
34-
Region string `json:"region"`
35-
Status LKEClusterStatus `json:"status"`
36-
K8sVersion string `json:"k8s_version"`
37-
Tags []string `json:"tags"`
30+
ID int `json:"id"`
31+
Created *time.Time `json:"-"`
32+
Updated *time.Time `json:"-"`
33+
Label string `json:"label"`
34+
Region string `json:"region"`
35+
Status LKEClusterStatus `json:"status"`
36+
K8sVersion string `json:"k8s_version"`
37+
Tags []string `json:"tags"`
38+
39+
// NOTE: Only cannot_delete applies to LKE clusters and can only be used with v4beta.
40+
Locks []LockType `json:"locks"`
41+
3842
ControlPlane LKEClusterControlPlane `json:"control_plane"`
3943

4044
// NOTE: Tier may not currently be available to all users and can only be used with v4beta.

lke_node_pools.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type LKENodePool struct {
7474
Taints []LKENodePoolTaint `json:"taints"`
7575
Label *string `json:"label"`
7676

77+
// NOTE: Only cannot_delete applies to LKE node pools and can only be used with v4beta.
78+
Locks []LockType `json:"locks"`
79+
7780
Autoscaler LKENodePoolAutoscaler `json:"autoscaler"`
7881
FirewallID *int `json:"firewall_id,omitempty"`
7982

nodebalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type NodeBalancer struct {
3939

4040
// An array of locks applied to this NodeBalancer for deletion protection.
4141
// Locks prevent the NodeBalancer or its subresources from being deleted.
42-
// NOTE: Locks can only be used with v4beta.
42+
// NOTE: Both cannot_delete and cannot_delete_with_subresources apply to NodeBalancers and can only be used with v4beta.
4343
Locks []LockType `json:"locks"`
4444

4545
Created *time.Time `json:"-"`

test/unit/fixtures/lke_cluster_get.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"label": "test-cluster",
44
"region": "us-east",
55
"status": "ready",
6+
"locks": ["cannot_delete"],
67
"subnet_id": 123,
78
"vpc_id": 456,
89
"stack_type": "ipv4",

test/unit/fixtures/lke_cluster_list.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"label": "test-cluster",
66
"region": "us-east",
77
"status": "ready",
8+
"locks": ["cannot_delete"],
89
"subnet_id": 123,
910
"vpc_id": 456,
1011
"stack_type": "ipv4",
@@ -16,7 +17,8 @@
1617
"id": 124,
1718
"label": "second-cluster",
1819
"region": "us-west",
19-
"status": "not_ready"
20+
"status": "not_ready",
21+
"locks": []
2022
}
2123
],
2224
"pages": 1,

test/unit/fixtures/lke_node_pool_get.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"id": 456,
33
"count": 3,
44
"type": "g6-standard-2",
5+
"locks": ["cannot_delete"],
56
"tags": ["tag1", "tag2"],
67
"labels": {"env": "staging"},
78
"autoscaler": {

test/unit/fixtures/lke_node_pool_list.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"id": 456,
55
"count": 3,
66
"type": "g6-standard-2",
7+
"locks": ["cannot_delete"],
78
"tags": ["tag1"],
89
"labels": {"env": "staging"},
910
"autoscaler": {"enabled": true, "min": 1, "max": 5}
@@ -12,6 +13,7 @@
1213
"id": 789,
1314
"count": 2,
1415
"type": "g6-standard-4",
16+
"locks": [],
1517
"tags": ["tag2"],
1618
"labels": {"env": "prod"},
1719
"autoscaler": {"enabled": false, "min": 0, "max": 0}

test/unit/fixtures/volume_get.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"linode_id": null,
88
"filesystem_path": "",
99
"tags": ["test"],
10+
"locks": ["cannot_delete_with_subresources"],
1011
"hardware_type": "",
1112
"linode_label": "",
1213
"encryption": "",

test/unit/fixtures/volumes_list.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"linode_id": null,
1010
"filesystem_path": "",
1111
"tags": ["test"],
12+
"locks": ["cannot_delete"],
1213
"hardware_type": "",
1314
"linode_label": "",
1415
"encryption": "",

0 commit comments

Comments
 (0)