-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from akamai/release/2.4.0
Release/2.4.0 => master
- Loading branch information
Showing
17 changed files
with
426 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
let Recommendations = require('../../src/recommendations').recommendations; | ||
let out = require('./lib/out'); | ||
|
||
class RecommendationsCommand { | ||
constructor() { | ||
this.flags = 'accept-recommendation'; | ||
this.desc = 'Accept Recommendation'; | ||
this.setup = this.setup.bind(this); | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
setup(sywac) { | ||
sywac | ||
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]') | ||
.number('--selector <selectorId>', { | ||
desc: 'Selector ID', | ||
group: 'Required:', | ||
required: true | ||
}) | ||
.number('--config <id>', { | ||
desc: 'Configuration ID. Mandatory if you have more than one configuration.', | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
.string('--version <id>', { | ||
desc: | ||
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.", | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
|
||
.string('--policy <id>', { | ||
desc: | ||
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.', | ||
group: 'Optional:', | ||
required: false | ||
}); | ||
} | ||
|
||
run(options) { | ||
options.action = 'ACCEPT'; | ||
options.selectorId = options['selector']; | ||
|
||
out.print({ | ||
promise: new Recommendations(options).postRecommendation(), | ||
args: options, | ||
success: (args, data) => { | ||
return JSON.stringify(data); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
module.exports = new RecommendationsCommand(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let Recommendations = require('../../src/recommendations').recommendations; | ||
let out = require('./lib/out'); | ||
|
||
class RecommendationsCommand { | ||
constructor() { | ||
this.flags = 'decline-recommendation'; | ||
this.desc = 'Decline Recommendation'; | ||
this.setup = this.setup.bind(this); | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
setup(sywac) { | ||
sywac | ||
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]') | ||
.number('--selector <selectorId>', { | ||
desc: "Selector ID", | ||
group: 'Required:', | ||
required: true | ||
}) | ||
.number('--config <id>', { | ||
desc: 'Configuration ID. Mandatory if you have more than one configuration.', | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
.string('--version <id>', { | ||
desc: | ||
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.", | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
|
||
.string('--policy <id>', { | ||
desc: | ||
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.', | ||
group: 'Optional:', | ||
required: false | ||
}); | ||
} | ||
|
||
run(options) { | ||
options.action = 'DECLINE'; | ||
options.selectorId = options['selector']; | ||
|
||
out.print({ | ||
promise: new Recommendations(options).postRecommendation(), | ||
args: options, | ||
success: (args, data) => { | ||
return JSON.stringify(data); | ||
} | ||
}) | ||
; | ||
} | ||
} | ||
|
||
module.exports = new RecommendationsCommand(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let Recommendations = require('../../src/recommendations').recommendations; | ||
let out = require('./lib/out'); | ||
|
||
class RecommendationsCommand { | ||
constructor() { | ||
this.flags = 'reset-recommendation'; | ||
this.desc = 'Reset Recommendation'; | ||
this.setup = this.setup.bind(this); | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
setup(sywac) { | ||
sywac | ||
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]') | ||
.number('--selector <selectorId>', { | ||
desc: "Selector ID", | ||
group: 'Required:', | ||
required: true | ||
}) | ||
.number('--config <id>', { | ||
desc: 'Configuration ID. Mandatory if you have more than one configuration.', | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
.string('--version <id>', { | ||
desc: | ||
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.", | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
|
||
.string('--policy <id>', { | ||
desc: | ||
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.', | ||
group: 'Optional:', | ||
required: false | ||
}); | ||
} | ||
|
||
run(options) { | ||
options.action = 'RESET'; | ||
options.selectorId = options['selector']; | ||
|
||
out.print({ | ||
promise: new Recommendations(options).postRecommendation(), | ||
args: options, | ||
success: (args, data) => { | ||
return JSON.stringify(data); | ||
} | ||
}) | ||
; | ||
} | ||
} | ||
|
||
module.exports = new RecommendationsCommand(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
let Recommendations = require('../../src/recommendations').recommendations; | ||
let out = require('./lib/out'); | ||
|
||
class RecommendationsCommand { | ||
constructor() { | ||
this.flags = 'recommendations'; | ||
this.desc = 'Display Recommendations'; | ||
this.setup = this.setup.bind(this); | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
setup(sywac) { | ||
sywac | ||
.positional('[attack-group-name]', { | ||
paramsDesc: 'The attack group name.' | ||
}) | ||
.number('--config <id>', { | ||
desc: 'Configuration ID. Mandatory if you have more than one configuration.', | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
.string('--version <id>', { | ||
desc: | ||
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.", | ||
group: 'Optional:', | ||
required: false | ||
}) | ||
.string('--policy <id>', { | ||
desc: | ||
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.', | ||
group: 'Optional:', | ||
required: false | ||
}); | ||
} | ||
|
||
run(options) { | ||
options.group = options['attack-group-name']; | ||
const promise = | ||
options.group != null | ||
? new Recommendations(options).getGroupRecommendations() | ||
: new Recommendations(options).getRecommendations(); | ||
out.print({ | ||
promise, | ||
args: options, | ||
success: (args, data) => { | ||
return JSON.stringify(data); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
module.exports = new RecommendationsCommand(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.