Skip to content

Commit a13a99b

Browse files
Add support to auto-allocate ipv4 addrs from range specified (#756)
* add support to auto-allocate ipv4 addrs from range specified * Update fixtures * Remove stale fixture --------- Co-authored-by: Lena Garber <[email protected]>
1 parent 0bb8fc2 commit a13a99b

34 files changed

+6201
-6370
lines changed

go.work.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0Y
5757
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
5858
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
5959
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
60+
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
6061
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
6162
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
6263
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
@@ -78,6 +79,7 @@ golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
7879
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
7980
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
8081
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
82+
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
8183
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
8284
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
8385
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=

nodebalancer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ type NodeBalancerTransfer struct {
4747
}
4848

4949
type NodeBalancerVPCOptions struct {
50-
IPv4Range string `json:"ipv4_range"`
51-
IPv6Range string `json:"ipv6_range,omitempty"`
52-
SubnetID int `json:"subnet_id"`
50+
IPv4Range string `json:"ipv4_range,omitempty"`
51+
IPv6Range string `json:"ipv6_range,omitempty"`
52+
SubnetID int `json:"subnet_id"`
53+
IPv4RangeAutoAssign bool `json:"ipv4_range_auto_assign,omitempty"`
5354
}
5455

5556
// NodeBalancerCreateOptions are the options permitted for CreateNodeBalancer

test/integration/example_nodebalancers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func ExampleClient_CreateNodeBalancerNode() {
158158
RootPass: randPassword(),
159159
Region: "us-southeast",
160160
Type: "g6-nanode-1",
161-
Image: "linode/debian9",
161+
Image: "linode/debian12",
162162
Booted: linodego.Pointer(false),
163163
FirewallID: GetFirewallID(),
164164
}

test/integration/fixtures/ExampleCreateNodeBalancer.yaml

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ interactions:
1414
url: https://api.linode.com/v4beta/nodebalancers
1515
method: POST
1616
response:
17-
body: '{"id": 767903, "label": "balancer767903", "region": "us-southeast", "hostname":
18-
"139-144-164-228.ip.linodeusercontent.com", "ipv4": "139.144.164.228", "ipv6":
19-
"1234::5678", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05",
20-
"client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null,
21-
"total": null}}'
17+
body: '{"id": 1595315, "label": "balancer1595315", "region": "us-southeast", "type":
18+
"common", "hostname": "139-144-167-61.ip.linodeusercontent.com", "ipv4": "139.144.167.61",
19+
"ipv6": "1234::5678", "created": "2018-01-02T03:04:05", "updated":
20+
"2018-01-02T03:04:05", "client_conn_throttle": 20, "client_udp_sess_throttle":
21+
0, "lke_cluster": null, "tags": [], "transfer": {"in": null, "out": null, "total":
22+
null}}'
2223
headers:
2324
Access-Control-Allow-Credentials:
2425
- "true"
@@ -30,18 +31,20 @@ interactions:
3031
- '*'
3132
Access-Control-Expose-Headers:
3233
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
34+
Akamai-Internal-Account:
35+
- '*'
3336
Cache-Control:
3437
- max-age=0, no-cache, no-store
3538
Connection:
3639
- keep-alive
3740
Content-Length:
38-
- "346"
41+
- "416"
3942
Content-Security-Policy:
4043
- default-src 'none'
4144
Content-Type:
4245
- application/json
4346
Expires:
44-
- Mon, 08 Jul 2024 13:57:47 GMT
47+
- Tue, 27 May 2025 14:05:03 GMT
4548
Pragma:
4649
- no-cache
4750
Strict-Transport-Security:
@@ -58,7 +61,7 @@ interactions:
5861
X-Oauth-Scopes:
5962
- '*'
6063
X-Ratelimit-Limit:
61-
- "400"
64+
- "1600"
6265
X-Xss-Protection:
6366
- 1; mode=block
6467
status: 200 OK
@@ -74,14 +77,15 @@ interactions:
7477
- application/json
7578
User-Agent:
7679
- linodego/dev https://github.com/linode/linodego
77-
url: https://api.linode.com/v4beta/nodebalancers/767903
80+
url: https://api.linode.com/v4beta/nodebalancers/1595315
7881
method: GET
7982
response:
80-
body: '{"id": 767903, "label": "balancer767903", "region": "us-southeast", "hostname":
81-
"139-144-164-228.ip.linodeusercontent.com", "ipv4": "139.144.164.228", "ipv6":
82-
"1234::5678", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05",
83-
"client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null,
84-
"total": null}}'
83+
body: '{"id": 1595315, "label": "balancer1595315", "region": "us-southeast", "type":
84+
"common", "hostname": "139-144-167-61.ip.linodeusercontent.com", "ipv4": "139.144.167.61",
85+
"ipv6": "1234::5678", "created": "2018-01-02T03:04:05", "updated":
86+
"2018-01-02T03:04:05", "client_conn_throttle": 20, "client_udp_sess_throttle":
87+
0, "lke_cluster": null, "tags": [], "transfer": {"in": null, "out": null, "total":
88+
null}}'
8589
headers:
8690
Access-Control-Allow-Credentials:
8791
- "true"
@@ -93,18 +97,20 @@ interactions:
9397
- '*'
9498
Access-Control-Expose-Headers:
9599
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
100+
Akamai-Internal-Account:
101+
- '*'
96102
Cache-Control:
97103
- max-age=0, no-cache, no-store
98104
Connection:
99105
- keep-alive
100106
Content-Length:
101-
- "346"
107+
- "416"
102108
Content-Security-Policy:
103109
- default-src 'none'
104110
Content-Type:
105111
- application/json
106112
Expires:
107-
- Mon, 08 Jul 2024 13:57:47 GMT
113+
- Tue, 27 May 2025 14:05:03 GMT
108114
Pragma:
109115
- no-cache
110116
Strict-Transport-Security:
@@ -122,14 +128,14 @@ interactions:
122128
X-Oauth-Scopes:
123129
- '*'
124130
X-Ratelimit-Limit:
125-
- "400"
131+
- "1600"
126132
X-Xss-Protection:
127133
- 1; mode=block
128134
status: 200 OK
129135
code: 200
130136
duration: ""
131137
- request:
132-
body: '{"label":"balancer767903_renamed","client_conn_throttle":20,"tags":[]}'
138+
body: '{"label":"balancer1595315_renamed","client_conn_throttle":20,"tags":[]}'
133139
form: {}
134140
headers:
135141
Accept:
@@ -138,14 +144,15 @@ interactions:
138144
- application/json
139145
User-Agent:
140146
- linodego/dev https://github.com/linode/linodego
141-
url: https://api.linode.com/v4beta/nodebalancers/767903
147+
url: https://api.linode.com/v4beta/nodebalancers/1595315
142148
method: PUT
143149
response:
144-
body: '{"id": 767903, "label": "balancer767903_renamed", "region": "us-southeast",
145-
"hostname": "139-144-164-228.ip.linodeusercontent.com", "ipv4": "139.144.164.228",
146-
"ipv6": "1234::5678", "created": "2018-01-02T03:04:05", "updated":
147-
"2018-01-02T03:04:05", "client_conn_throttle": 20, "tags": [], "transfer": {"in":
148-
null, "out": null, "total": null}}'
150+
body: '{"id": 1595315, "label": "balancer1595315_renamed", "region": "us-southeast",
151+
"type": "common", "hostname": "139-144-167-61.ip.linodeusercontent.com", "ipv4":
152+
"139.144.167.61", "ipv6": "1234::5678", "created": "2018-01-02T03:04:05",
153+
"updated": "2018-01-02T03:04:05", "client_conn_throttle": 20, "client_udp_sess_throttle":
154+
0, "lke_cluster": null, "tags": [], "transfer": {"in": null, "out": null, "total":
155+
null}}'
149156
headers:
150157
Access-Control-Allow-Credentials:
151158
- "true"
@@ -157,18 +164,20 @@ interactions:
157164
- '*'
158165
Access-Control-Expose-Headers:
159166
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
167+
Akamai-Internal-Account:
168+
- '*'
160169
Cache-Control:
161170
- max-age=0, no-cache, no-store
162171
Connection:
163172
- keep-alive
164173
Content-Length:
165-
- "354"
174+
- "424"
166175
Content-Security-Policy:
167176
- default-src 'none'
168177
Content-Type:
169178
- application/json
170179
Expires:
171-
- Mon, 08 Jul 2024 13:57:48 GMT
180+
- Tue, 27 May 2025 14:05:03 GMT
172181
Pragma:
173182
- no-cache
174183
Strict-Transport-Security:
@@ -185,7 +194,7 @@ interactions:
185194
X-Oauth-Scopes:
186195
- '*'
187196
X-Ratelimit-Limit:
188-
- "400"
197+
- "1600"
189198
X-Xss-Protection:
190199
- 1; mode=block
191200
status: 200 OK
@@ -201,7 +210,7 @@ interactions:
201210
- application/json
202211
User-Agent:
203212
- linodego/dev https://github.com/linode/linodego
204-
url: https://api.linode.com/v4beta/nodebalancers/767903
213+
url: https://api.linode.com/v4beta/nodebalancers/1595315
205214
method: DELETE
206215
response:
207216
body: '{}'
@@ -216,6 +225,8 @@ interactions:
216225
- '*'
217226
Access-Control-Expose-Headers:
218227
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
228+
Akamai-Internal-Account:
229+
- '*'
219230
Cache-Control:
220231
- max-age=0, no-cache, no-store
221232
Connection:
@@ -227,7 +238,7 @@ interactions:
227238
Content-Type:
228239
- application/json
229240
Expires:
230-
- Mon, 08 Jul 2024 13:57:48 GMT
241+
- Tue, 27 May 2025 14:05:04 GMT
231242
Pragma:
232243
- no-cache
233244
Strict-Transport-Security:
@@ -244,7 +255,7 @@ interactions:
244255
X-Oauth-Scopes:
245256
- '*'
246257
X-Ratelimit-Limit:
247-
- "400"
258+
- "1600"
248259
X-Xss-Protection:
249260
- 1; mode=block
250261
status: 200 OK

0 commit comments

Comments
 (0)