Skip to content

Commit

Permalink
Merge pull request #37 from akamai/release/2.6.0
Browse files Browse the repository at this point in the history
Release/2.6.0 --> master
  • Loading branch information
shubhammk authored Feb 17, 2022
2 parents 7e3afdb + 499af48 commit 0257aed
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 17 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 2.5.0 (September Release)
## 2.6.0 (February Release)
- New Command:
- `activation-history` command lists activation history for the configuration

## 2.5.0 (January Release)
- New Command:
- `evasive-path-match` command displays the evasive path match settings
- `enable-evasive-path-match` command enables evasive path match settings
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ Commands:
accept-recommendation Accept a recommendation.
decline-recommendation Decline a recommendation.
reset-recommendation Reset a recommendation.
activation-history List activation history for the configuration.
Command options:
--json Print the raw json response. All commands respect this option. [boolean]
Expand Down
38 changes: 38 additions & 0 deletions bin/commands/activationhistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
let ActivationHistory = require('../../src/activationhistory').activationHistory;
let out = require('./lib/out');

const objectType = 'activationHistory';

class GetActivationHistoryCommand {
constructor() {
this.flags = 'activation-history';
this.desc = 'List activation history for the configuration.';
this.setup = this.setup.bind(this);
this.run = this.run.bind(this);
}

setup(sywac) {
sywac.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
group: 'Optional:',
required: false
});
}

run(options) {
out.print({
promise: new ActivationHistory(options).getActivationHistory(),
args: options,
objectType,
success: (args, data) => {
let s = [];
data[objectType].forEach(activation => {
s.push(activation.activationId);
});
return s.join(require('os').EOL);
}
});
}
}

module.exports = new GetActivationHistoryCommand();
2 changes: 1 addition & 1 deletion cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"commands": [
{
"name": "appsec",
"version": "2.5.0",
"version": "2.6.0",
"description": "Akamai Security tools for protecting websites."
}
]
Expand Down
34 changes: 23 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "akamaicliappsec",
"version": "2.5.0",
"version": "2.6.0",
"description": "A wrapping development kit to interface common tasks with akamai's Security {OPEN} API.",
"repository": "https://github.com/akamai/cli-appsec",
"license": "Apache-2.0",
Expand Down Expand Up @@ -30,7 +30,7 @@
"yarn": "^1.22.10"
},
"devDependencies": {
"chai": "^4.1.2",
"chai": "^4.3.6",
"eslint": "^8.6.0",
"fs": "0.0.1-security",
"husky": "^0.14.3",
Expand Down
19 changes: 19 additions & 0 deletions src/activationhistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

let URIs = require('./constants').URIS;
let Config = require('./configprovider').configProvider;

class ActivationHistory {
constructor(options) {
this._config = new Config(options);
this._options = options;
}

getActivationHistory() {
return this._config.readResource(URIs.ACTIVATION_HISTORY, []);
}
}

module.exports = {
activationHistory: ActivationHistory
};
7 changes: 5 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ const resources = {
'/appsec/v1/configs/%s/versions/%s/hostname-coverage/overlapping?hostname=%s',
THREAT_INTEL: '/appsec/v1/configs/%s/versions/%s/security-policies/%s/threat-intel',
RECOMMENDATIONS: '/appsec/v1/configs/%s/versions/%s/security-policies/%s/recommendations',
RULE_RECOMMENDATIONS: '/appsec/v1/configs/%s/versions/%s/security-policies/%s/recommendations/rules/%s',
GROUP_RECOMMENDATIONS: '/appsec/v1/configs/%s/versions/%s/security-policies/%s/recommendations/attack-group/%s'
RULE_RECOMMENDATIONS:
'/appsec/v1/configs/%s/versions/%s/security-policies/%s/recommendations/rules/%s',
GROUP_RECOMMENDATIONS:
'/appsec/v1/configs/%s/versions/%s/security-policies/%s/recommendations/attack-group/%s',
ACTIVATION_HISTORY: '/appsec/v1/configs/%s/activations'
};

define('URIS', resources);
Expand Down

0 comments on commit 0257aed

Please sign in to comment.