Skip to content

Commit 63b539e

Browse files
committed
Fixed breaking changes for saf 1.0.7
Signed-off-by: yarick <yarick@yarick.net>
1 parent 6866b40 commit 63b539e

File tree

3 files changed

+234
-82
lines changed

3 files changed

+234
-82
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

saf-lambda-function/app.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const winston = require('winston');
1212
const { createLogger, format, transports } = winston;
1313
let response;
1414

15+
function delay(ms) {
16+
return new Promise((resolve) => setTimeout(resolve, ms));
17+
}
18+
1519
/**
1620
*
1721
* Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format
@@ -54,7 +58,7 @@ exports.lambdaHandler = async (event, context) => {
5458

5559
// TODO: Decide is we want to catch undefined saf-cli command groupings
5660
// https://stackoverflow.com/questions/15201939/jquery-javascript-check-string-for-multiple-substringsa
57-
// TODO: Removed hardcoded data and move to lambda paramaters
61+
// TODO: Removed hardcoded data and move to lambda parameters
5862
const HEC_TOKEN = "473b3297-1d88-4740-96ff-e6048e51b785";
5963
const SPLUNK_SERVER = "splk1.efficacy.online";
6064
const CLI_COMMAND = "convert"
@@ -102,7 +106,9 @@ exports.lambdaHandler = async (event, context) => {
102106

103107
Body = Body.toString();
104108

105-
const command_string = [CLI_COMMAND+':'+CLI_FUNCTION, '-i', HDF_FILE, '-H', SPLUNK_SERVER, '-t', HEC_TOKEN ];
109+
110+
// saf convert:hdf2splunk -i ./example-3-layer-overlay_03062022.json -H splk1.efficacy.online -u admin -p SPLUNK-i-0e35b2c99e66b54a0 -I hdf
111+
const command_string = [CLI_COMMAND+':'+CLI_FUNCTION, '-i', HDF_FILE, '-H', SPLUNK_SERVER, '-u', 'admin', '-p', 'SPLUNK-i-0e35b2c99e66b54a0', '-I', 'dev_hdf'];
106112

107113
await fs.writeFileSync(HDF_FILE, Body)
108114

@@ -139,6 +145,8 @@ exports.lambdaHandler = async (event, context) => {
139145

140146
let saf_cli_response = await saf.run(command_string);
141147

148+
await delay(5000);
149+
142150
response = {
143151
'statusCode': 200,
144152
'body': JSON.stringify({

0 commit comments

Comments
 (0)