Skip to content

Commit b2a74ca

Browse files
Merge pull request #26 from alertlogic/npm
Npm
2 parents b3c3049 + 00603d5 commit b2a74ca

File tree

4 files changed

+48
-55
lines changed

4 files changed

+48
-55
lines changed

README.md

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,31 @@ This repository contains the common JavaScript functions used by Node.js collect
1111

1212
# HOWTO use this library in an AWS Lambda function
1313

14-
Create a `package.json` file for [npm](https://www.npmjs.com/) 2.7.0 (or greater) in the root of your AWS Lambda function Node.js root directory. Include this repo in the `dependencies` and `devDependencies` section as required.
14+
To install:
15+
`npm i @alertlogic/al-aws-collector-js`
16+
17+
in your file
18+
```javascript
19+
const {
20+
AlAwsCollector,
21+
} = require('@alertlogic/al-aws-collect-js');
22+
```
1523

16-
For example:
24+
# API
1725

18-
```
19-
{
20-
"name": "al-my-collector",
21-
"version": "1.0.0",
22-
"description": "Alert Logic My Collector",
23-
"repository": {},
24-
"private": true,
25-
"scripts": {
26-
"start": "node index.js",
27-
"lint": "jshint --exclude \"./node_modules/*\" **/*.js",
28-
"test": "JUNIT_REPORT_PATH=./test/report.xml nyc --reporter=cobertura mocha --colors --reporter mocha-jenkins-reporter"
29-
},
30-
"devDependencies": {
31-
"aws-sdk": "*",
32-
"aws-sdk-mock": "*",
33-
"dotenv": "*",
34-
"clone": "*",
35-
"jshint": "^2.9.5",
36-
"mocha": "^3.5.3",
37-
"mocha-jenkins-reporter": "^0.3.10",
38-
"nyc": "^11.3.0",
39-
"rewire": "^2.5.2",
40-
"sinon": "^3.3.0"
41-
},
42-
"dependencies": {
43-
"async": "*",
44-
"cfn-response": "*",
45-
"moment": "^2.19.2",
46-
"request": "*",
47-
"request-promise-native": "*",
48-
"al-aws-collector-js": "git://github.com/alertlogic/al-aws-collector-js#master"
49-
},
50-
"author": "Alert Logic Inc."
51-
}
52-
```
26+
## `AlAwsCollector`
27+
Base class for AWS lambda based collectors
28+
29+
* @param {Object} context - context of Lambdas function.
30+
* @param {string} collectorType - collector type (cwe as example).
31+
* @param {string} ingestType - ingest data type (secmsgs, vpcflow, etc).
32+
* @param {string} version - version of collector.
33+
* @param {Object} aimsCreds - Alert Logic API credentials.
34+
* @param {string} [aimsCreds.access_key_id] - Alert Logic API access key id.
35+
* @param {string} [aimsCreds.secret_key] - Alert Logic API secret key.
36+
* @param {function} formatFun - callback formatting function
37+
* @param {Array.<function>} healthCheckFuns - list of custom health check functions (can be just empty, so only common are applied)
38+
* @param {Array.<function>} statsFuns - list of custom stats functions (can be just empty, so only common are applied)
5339

5440
# Debugging
5541

@@ -69,10 +55,6 @@ value "index" or "*".
6955

7056
See [debug](https://www.npmjs.com/package/debug) for further details.
7157

72-
# Known Issues/ Open Questions
73-
74-
- TBD.
75-
7658
# Useful Links
7759

7860
- [Node.js static code analysis tool](http://jshint.com/install/)

al_aws_collector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const async = require('async');
1616
const response = require('cfn-response');
1717
const deepEqual = require('deep-equal');
1818

19-
const m_alCollector = require('al-collector-js');
19+
const m_alCollector = require('@alertlogic/al-collector-js');
2020
const m_alAws = require('./al_aws');
2121
const m_healthChecks = require('./health_checks');
2222
const m_stats = require('./statistics');

package.json

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
{
2-
"name": "al-aws-collector-js",
3-
"version": "1.0.0",
2+
"name": "@alertlogic/al-aws-collector-js",
3+
"version": "1.1.2",
4+
"license": "MIT",
45
"description": "Alert Logic AWS Collector Common Library",
5-
"repository": {},
6-
"private": true,
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/alertlogic/al-aws-collector-js#npm"
9+
},
10+
"private": false,
711
"scripts": {
812
"lint": "jshint --exclude \"./node_modules/*\" **/*.js",
913
"test": "JUNIT_REPORT_PATH=./test/report.xml nyc --reporter=cobertura mocha --colors --reporter mocha-jenkins-reporter"
1014
},
15+
"main": "index.js",
16+
"maintainers": [
17+
{
18+
"name": "Alert Logic NPM Team",
19+
"email": "[email protected]"
20+
}
21+
],
1122
"devDependencies": {
12-
"aws-sdk": "*",
13-
"aws-sdk-mock": "*",
14-
"dotenv": "*",
15-
"clone": "*",
23+
"aws-sdk": "^2.441.0",
24+
"aws-sdk-mock": "^4.4.0",
25+
"dotenv": "^7.0.0",
26+
"clone": "^2.1.2",
1627
"jshint": "^2.9.5",
1728
"mocha": "^3.5.3",
1829
"mocha-jenkins-reporter": "^0.3.10",
@@ -21,11 +32,11 @@
2132
"sinon": "^3.3.0"
2233
},
2334
"dependencies": {
24-
"al-collector-js": "git://github.com/alertlogic/al-collector-js#master",
25-
"cfn-response": "*",
26-
"async": "*",
35+
"@alertlogic/al-collector-js": "^1.1.2",
36+
"cfn-response": "^1.0.1",
37+
"async": "^2.6.1",
2738
"moment": "^2.19.2",
28-
"deep-equal": "*"
39+
"deep-equal": "^1.0.1"
2940
},
3041
"author": "Alert Logic Inc."
3142
}

test/al_aws_collector_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const m_response = require('cfn-response');
55
const deepEqual = require('deep-equal');
66

77
const AlAwsCollector = require('../al_aws_collector');
8-
var m_alCollector = require('al-collector-js');
8+
var m_alCollector = require('@alertlogic/al-collector-js');
99
const m_healthChecks = require('../health_checks');
1010
var AWS = require('aws-sdk-mock');
1111
const colMock = require('./collector_mock');

0 commit comments

Comments
 (0)