Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit a36e642

Browse files
author
Chris Wiechmann
committed
Is ignoreAPI now checks if APIPath or PolicyName contains an unresolved
Logstash variable name.
1 parent 0b6164b commit a36e642

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/actions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ async function isIgnoreAPI(params, options) {
216216
if (!apiPath && !policyName) {
217217
return { status: 400, body: { message: 'You must either provide the apiPath or the policyName used to read the configuration.' }};
218218
}
219+
debugger;
220+
if(apiPath && apiPath.startsWith("%{[") && apiPath.endsWith("]}")) {
221+
return { status: 400, body: { message: `API-Path contains unresolved Logstash variable: '${apiPath}'. Please check Logstash pipeline configuration.` }};
222+
}
223+
if(policyName && policyName.startsWith("%{[") && policyName.endsWith("]}")) {
224+
return { status: 400, body: { message: `Policy-Name contains unresolved Logstash variable: '${policyName}'. Please check Logstash pipeline configuration.` }};
225+
}
219226
if(region) {
220227
region = region.toLowerCase();
221228
params.region = region;

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/test/test-isIgnoreAPI.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,19 @@ describe('Test is Index-API', () => {
8686
expect(value.status).to.equal(200);
8787
expect(output).to.equal('next');
8888
});
89+
90+
it('[isIgnoreAPI-0006] should return an error if the apiPath contains an unresolved Logstash variable', async () => {
91+
const { value, output } = await flowNode.isIgnoreAPI({ policyName: "%{[transact-something-in-the-middle-ri]}" });
92+
93+
expect(value).to.deep.equal({status: 400, body: { message: "Policy-Name contains unresolved Logstash variable: '%{[transact-something-in-the-middle-ri]}'. Please check Logstash pipeline configuration." }});
94+
expect(output).to.equal('next');
95+
});
96+
97+
it('[isIgnoreAPI-0006] should return an error if the apiPath contains an unresolved Logstash variable', async () => {
98+
const { value, output } = await flowNode.isIgnoreAPI({ apiPath: "%{[transact-something-in-the-middle-ri]}" });
99+
100+
expect(value).to.deep.equal({status: 400, body: { message: "API-Path contains unresolved Logstash variable: '%{[transact-something-in-the-middle-ri]}'. Please check Logstash pipeline configuration." }});
101+
expect(output).to.equal('next');
102+
});
89103
});
90104
});

0 commit comments

Comments
 (0)