diff --git a/index.js b/index.js index 670f448..8a54aaa 100644 --- a/index.js +++ b/index.js @@ -290,6 +290,19 @@ HAProxy.prototype.enable = function enable(backend, server, fn) { return this.send('enable server %s/%s', backend, server).call(fn); }; +/** + * Set the server state to [ ready / maint / drain ] + * + * @param {String} backend Name of the backend server. + * @param {String} server The server that needs to be disabled in the backend. + * @param {String} newState new state for the server [ ready / maint / drain ] + * @param {Function} fn Callback. + * @api public + */ +HAProxy.prototype.state = function state(backend, server, newState, fn) { + return this.send('set server %s/%s state %s', backend || '', server || '', newState || '').call(fn); +}; + /** * Mark the frontend as temporarilty stopped. This corresponds to the mode which * is used during a soft restart. THe frontend releases the port but it can be