Skip to content

Commit

Permalink
Merge pull request #383 from vultr/issue-370
Browse files Browse the repository at this point in the history
resolves issue #370
  • Loading branch information
ddymko authored Sep 1, 2020
2 parents ccb407c + 69cc2ed commit dd1a4bd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,3 +1133,45 @@ exports.deleteReverseIPv6 = {
}
}
}

/**
* Enables DDoS Protection for a server.<br>
* {@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.<br>
* {@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
}
}
}
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 6 additions & 0 deletions test/api/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ const mockParameters = {
deleteReverseIPv6: {
SUBID: 1312965,
ip: '192.0.2.1'
},
enableDDoSProtection: {
SUBID: 1312965
},
disableDDoSProtection: {
SUBID: 1312965
}
}

Expand Down

0 comments on commit dd1a4bd

Please sign in to comment.