-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add agent status datatype into Ingestc. (#37)
* Add agent status datatype into Ingestc. * Separate out ingestc * Code cleanup * Remove aicspmsgs
- Loading branch information
kkuzmin
authored
Mar 11, 2020
1 parent
db1f490
commit 29f0ea9
Showing
5 changed files
with
100 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* ----------------------------------------------------------------------------- | ||
* @copyright (C) 2020, Alert Logic, Inc | ||
* @doc | ||
* | ||
* HTTP client for Ingest service. | ||
* | ||
* @end | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
'use strict'; | ||
|
||
const AlServiceC = require('./al_servicec').AlServiceC; | ||
|
||
/** | ||
* @class | ||
* HTTPS client for Alert Logic Ingest service. | ||
* | ||
* @constructor | ||
* @param {string} apiEndpoint - Alert Logic API hostname. | ||
* @param {Object} aimsCreds - Alert Logic API credentials object, refer to AimsC. | ||
* @param {string} [aimsCreds.access_key_id] - Alert Logic API access key id. | ||
* @param {string} [aimsCreds.secret_key] - Alert Logic API secret key. | ||
* | ||
*/ | ||
class IngestC extends AlServiceC { | ||
constructor(apiEndpoint, aimsCreds, functionType, retryOptions) { | ||
super(apiEndpoint, 'ingest', 'v1', aimsCreds, retryOptions); | ||
this._functionType = functionType ? functionType : 'lambda_function'; | ||
} | ||
|
||
sendSecmsgs(data) { | ||
let payload = { | ||
json : false, | ||
headers : { | ||
'Content-Type': 'alertlogic.com/cwe-json', | ||
'x-invoked-by' : this._functionType, | ||
'Content-Encoding' : 'deflate', | ||
'Content-Length' : Buffer.byteLength(data) | ||
}, | ||
body : data | ||
}; | ||
return this.post(`/data/secmsgs`, payload); | ||
} | ||
|
||
sendVpcFlow(data) { | ||
let payload = { | ||
json : false, | ||
headers : { | ||
'Content-Type': 'alertlogic.com/cwl-json', | ||
'x-invoked-by' : this._functionType, | ||
'Content-Encoding' : 'deflate', | ||
'Content-Length' : Buffer.byteLength(data) | ||
}, | ||
body : data | ||
}; | ||
return this.post(`/data/vpcflow`, payload); | ||
} | ||
|
||
sendLogmsgs(data) { | ||
let payload = { | ||
json : false, | ||
headers : { | ||
'Content-Type': 'alertlogic.com/lm3-protobuf', | ||
'x-invoked-by' : this._functionType, | ||
'Content-Encoding' : 'deflate', | ||
'Content-Length' : Buffer.byteLength(data) | ||
}, | ||
body : data | ||
}; | ||
return this.post(`/data/logmsgs`, payload); | ||
} | ||
|
||
sendAgentstatus(data) { | ||
let payload = { | ||
json : false, | ||
headers : { | ||
'Content-Type': 'alertlogic.com/json', | ||
'x-invoked-by' : this._functionType, | ||
'Content-Encoding' : 'deflate', | ||
'Content-Length' : Buffer.byteLength(data) | ||
}, | ||
body : data | ||
}; | ||
return this.post(`/data/agentstatus`, payload); | ||
} | ||
} | ||
|
||
module.exports = { | ||
IngestC: IngestC | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters