Skip to content

Commit f531ff1

Browse files
update load balancer calls that need to consume and return proxy data
1 parent d1b2fb8 commit f531ff1

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/api/load-balancer.js

+15
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ exports.getFullConfig = {
3838
* @param {string} [parameters.sticky_sessions] - Enables sticky sessions for your load balancer; use `on` or `off`.
3939
* @param {string} [parameters.cookie_name] - Name for your sticky session cookie.
4040
* @param {string} [parameters.balancing_algorithm] - Balancing algorithm for your load balancer; use `roundrobin` or `leastconn`.
41+
* @param {string} [parameters.proxy_protocol] - Enables proxy protocol; use `on` or `off`.
4142
* @param {object} [parameters.health_check] - Define health checks for your attached back end nodes.
4243
* @param {array} [parameters.forwarding_rules] - Define forwarding rules the load balancer will follow.
4344
* @param {string} [parameters.ssl_private_key] - The SSL certificate's private key.
4445
* @param {string} [parameters.ssl_certificate] - The SSL certificate.
4546
* @param {string} [parameters.ssl_chain] - The SSL certificate chain.
47+
* @param {string} [parameters.attached_nodes] - List which instances to attach to the load balancer.
4648
*/
4749
exports.create = {
4850
url: '/loadbalancer/create',
@@ -73,6 +75,10 @@ exports.create = {
7375
type: 'string',
7476
required: false
7577
},
78+
proxy_protocol: {
79+
type: 'string',
80+
required: false
81+
},
7682
health_check: {
7783
type: 'object',
7884
required: false
@@ -92,6 +98,10 @@ exports.create = {
9298
ssl_chain: {
9399
type: 'string',
94100
required: false
101+
},
102+
attached_nodes: {
103+
type: 'array',
104+
required: false
95105
}
96106
}
97107
}
@@ -241,6 +251,7 @@ exports.getGenericInfo = {
241251
* @param {string} [parameters.sticky_sessions] - Enables sticky sessions for your load balancer; use `on` or `off`.
242252
* @param {string} [parameters.cookie_name] - Name for your sticky session.
243253
* @param {boolean} [parameters.ssl_redirect] - Force HTTP to HTTPS.
254+
* @param {string} [parameters.proxy_protocol] - Enables proxy protocol; use `on` or `off`.
244255
*/
245256
exports.updateGenericInfo = {
246257
url: '/loadbalancer/generic_update',
@@ -270,6 +281,10 @@ exports.updateGenericInfo = {
270281
ssl_redirect: {
271282
type: 'boolean',
272283
required: false
284+
},
285+
proxy_protocol: {
286+
type: 'string',
287+
required: false
273288
}
274289
}
275290
}

test/api/load-balancer.test.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const mock = {
77
ssl_redirect: false,
88
sticky_sessions: {
99
cookie_name: 'tests'
10-
}
10+
},
11+
proxy_protocol: false
1112
},
1213
health_checks_info: {
1314
protocol: 'http',
@@ -52,7 +53,8 @@ const mock = {
5253
ssl_redirect: false,
5354
sticky_sessions: {
5455
cookie_name: ''
55-
}
56+
},
57+
proxy_protocol: false
5658
},
5759
getHealthCheckinfo: {
5860
protocol: 'https',
@@ -94,6 +96,7 @@ const mockParameters = {
9496
sticky_sessions: 'on',
9597
cookie_name: 'lbCookie1',
9698
balancing_algorithm: 'roundrobin',
99+
proxy_protocol: 'off',
97100
health_check: {
98101
protocol: 'https',
99102
port: 81,
@@ -113,7 +116,8 @@ const mockParameters = {
113116
],
114117
ssl_private_key: '1111',
115118
ssl_certificate: 'path/to/certificate',
116-
ssl_chain: '2222'
119+
ssl_chain: '2222',
120+
attached_nodes: [12345, 54321]
117121
},
118122
delete: {
119123
SUBID: 1314840
@@ -141,7 +145,8 @@ const mockParameters = {
141145
balancing_algorithm: 'leastconn',
142146
sticky_sessions: 'off',
143147
cookie_name: 'genericCookie',
144-
ssl_redirect: true
148+
ssl_redirect: true,
149+
proxy_protocol: 'off'
145150
},
146151
getHealthCheckInfo: {
147152
SUBID: 1314840

0 commit comments

Comments
 (0)