Skip to content

Commit fd25ad7

Browse files
author
Arul Nedumaran
committed
Merge pull request #7 in KSD/cli-appsec from feature/KSD-14282 to develop
* commit 'b98a392f5e645db3a1779b5029a8062c9e9511f1': Remove old method.
2 parents 2ef3189 + b98a392 commit fd25ad7

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

src/appSecConfig.js

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class AppSecConfig {
1919
}
2020

2121
versions(options) {
22-
2322
return this._configProvider.getConfigId(options.config)
2423
.then((configId) => {
2524
return new Promise((resolve) => {
@@ -51,7 +50,6 @@ class AppSecConfig {
5150
}
5251

5352
version(options) {
54-
5553
return this._configProvider.getConfigId(options.config)
5654
.then((configId) => {
5755
return new Promise((resolve) => {
@@ -72,31 +70,8 @@ class AppSecConfig {
7270
throw err;
7371
});
7472
}
75-
76-
rules(providedConfigId) {
77-
78-
let configId = this._getConfigId(providedConfigId);
79-
80-
return new Promise((resolve, reject) => {
81-
let customRulesUrl = URIs.GET_CRB.format(configId);
82-
logger.debug("Attempting to get all custom rules at: " + customRulesUrl);
83-
let request = {
84-
method: "GET",
85-
path: customRulesUrl,
86-
followRedirect: false
87-
};
88-
this._edge.auth(request).send(function (data, response) {
89-
if (response && response.statusCode >= 200 && response.statusCode < 400) {
90-
let parsed = JSON.parse(response.body);
91-
resolve(parsed);
92-
} else {
93-
reject(data);
94-
}
95-
});
96-
});
97-
}
9873
}
9974

10075
module.exports = {
10176
AppSecConfig: AppSecConfig
102-
};
77+
};

src/constants.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ var logger = function (loggerName) {
1212
name: loggerName
1313
});
1414
};
15-
15+
const CRB='/appsec-resource/v1/configs/%s/custom-rules';
1616
var resources = {
1717
"GET_CONFIGS": '/appsec-configuration/v1/configs',
1818
"GET_VERSIONS": '/appsec-configuration/v1/configs/%s/versions',
1919
"GET_VERSION": '/appsec-configuration/v1/configs/%s/versions/%s',
20-
"GET_CRB": '/appsec-resource/v1/configs/%s/custom-rules'
20+
"GET_CRB_ALL": CRB,
21+
"GET_CRB": CRB + '/%s'
2122
};
2223

2324
define("URIS", resources);
24-
define("logger", logger);
25+
define("logger", logger);

src/crb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CRBHandler {
3636
rules(providedConfigId) {
3737
let configId = this._configProvider.getConfigId(providedConfigId);
3838
return new Promise((resolve, reject) => {
39-
let customRulesUrl = util.format(URIs.GET_CRB, configId);
39+
let customRulesUrl = util.format(URIs.GET_CRB_ALL, configId);
4040
logger.debug("Attempting to get all custom rules at: " + customRulesUrl);
4141
let request = {
4242
method: "GET",

0 commit comments

Comments
 (0)