@@ -12,6 +12,10 @@ const winston = require('winston');
12
12
const { createLogger, format, transports } = winston ;
13
13
let response ;
14
14
15
+ function delay ( ms ) {
16
+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
17
+ }
18
+
15
19
/**
16
20
*
17
21
* 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) => {
54
58
55
59
// TODO: Decide is we want to catch undefined saf-cli command groupings
56
60
// 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
58
62
const HEC_TOKEN = "473b3297-1d88-4740-96ff-e6048e51b785" ;
59
63
const SPLUNK_SERVER = "splk1.efficacy.online" ;
60
64
const CLI_COMMAND = "convert"
@@ -102,7 +106,9 @@ exports.lambdaHandler = async (event, context) => {
102
106
103
107
Body = Body . toString ( ) ;
104
108
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' ] ;
106
112
107
113
await fs . writeFileSync ( HDF_FILE , Body )
108
114
@@ -139,6 +145,8 @@ exports.lambdaHandler = async (event, context) => {
139
145
140
146
let saf_cli_response = await saf . run ( command_string ) ;
141
147
148
+ await delay ( 5000 ) ;
149
+
142
150
response = {
143
151
'statusCode' : 200 ,
144
152
'body' : JSON . stringify ( {
0 commit comments