diff --git a/src/api/server.js b/src/api/server.js index d9989a24..0296de0f 100644 --- a/src/api/server.js +++ b/src/api/server.js @@ -1133,3 +1133,45 @@ exports.deleteReverseIPv6 = { } } } + +/** + * Enables DDoS Protection for a server.
+ * {@link https://www.vultr.com/api/#server_ddos_protection_enable} + * @function enableDDoSProtection + * @memberof server + * @instance + * @param {object} parameters + * @param {number} parameters.SUBID - Unique identifier of a subscription. + */ +exports.enableDDoSProtection = { + url: '/server/ddos_protection_enable', + requestType: 'POST', + apiKeyRequired: true, + parameters: { + SUBID: { + type: 'number', + required: true + } + } +} + +/** + * Disables DDoS Protection for a server.
+ * {@link https://www.vultr.com/api/#server_ddos_protection_disable} + * @function disableDDoSProtection + * @memberof server + * @instance + * @param {object} parameters + * @param {number} parameters.SUBID - Unique identifier of a subscription. + */ +exports.disableDDoSProtection = { + url: '/server/ddos_protection_disable', + requestType: 'POST', + apiKeyRequired: true, + parameters: { + SUBID: { + type: 'number', + required: true + } + } +} diff --git a/src/index.js b/src/index.js index f1425f01..53c14bd8 100644 --- a/src/index.js +++ b/src/index.js @@ -274,7 +274,9 @@ exports.initialize = config => { setDefaultReverseIPv4: createRequestFunction( server.setDefaultReverseIPv4 ), - deleteReverseIPv6: createRequestFunction(server.deleteReverseIPv6) + deleteReverseIPv6: createRequestFunction(server.deleteReverseIPv6), + enableDDoSProtection: createRequestFunction(server.enableDDoSProtection), + disableDDoSProtection: createRequestFunction(server.disableDDoSProtection) }, snapshot: { create: createRequestFunction(snapshot.create), diff --git a/test/api/server.test.js b/test/api/server.test.js index 121bec43..a18fcc7c 100644 --- a/test/api/server.test.js +++ b/test/api/server.test.js @@ -324,6 +324,12 @@ const mockParameters = { deleteReverseIPv6: { SUBID: 1312965, ip: '192.0.2.1' + }, + enableDDoSProtection: { + SUBID: 1312965 + }, + disableDDoSProtection: { + SUBID: 1312965 } }