cloudmonkey
Advanced tools
Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4
{ | ||
"name": "cloudmonkey", | ||
"version": "1.0.0-alpha.3", | ||
"version": "1.0.0-alpha.4", | ||
"description": "Small infrastructure testing framework -- EXPERIMENTAL", | ||
@@ -33,4 +33,3 @@ "main": "src/index.js", | ||
"aws-sdk": "^2.205.0", | ||
"bluebird": "^3.5.1", | ||
"lodash": "^4.17.5" | ||
"bluebird": "^3.5.1" | ||
}, | ||
@@ -43,3 +42,3 @@ "devDependencies": { | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.18.1", | ||
"eslint": "^4.18.2", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
@@ -50,4 +49,2 @@ "eslint-plugin-import": "^2.9.0", | ||
"mocha": "^5.0.1", | ||
"mock-aws-sinon": "^1.0.6", | ||
"nodemon": "^1.17.1", | ||
"nyc": "^11.4.1", | ||
@@ -54,0 +51,0 @@ "sinon": "^4.4.2", |
@@ -95,3 +95,4 @@ # CloudMonkey | ||
The selection interface provides a means to select resources in your infrastructure. For example: | ||
The selection interface provides a means to select resources in your infrastructure. | ||
For example: | ||
```javascript | ||
@@ -147,1 +148,40 @@ const monkey = new CloudMonkey(); | ||
``` | ||
### Extending CloudMonkey with new services | ||
CloudMonkey per se is cloud-agnostic. | ||
It only knows services (which strictly speaking don't even have to be cloud services) and their resource types. | ||
To add new services to CloudMonkey, simply derive from `Service`. | ||
A quick example: | ||
```javascript | ||
const { CloudMonkey, Service } = require('cloudmonkey'); | ||
class FooService extends Service { | ||
constructor({ alias } = {}) { | ||
super({ name: 'foo', alias }); | ||
// register resource type 'bar' | ||
this.register({ | ||
name: 'bar', | ||
list: async () => Promise.resolve([]), // array of `bar` resources | ||
filters: { | ||
id: (bar, value) => bar.id === value, | ||
}, | ||
identity: bar => bar.id, | ||
travel: { | ||
baz: async (bars) => Promise.resolve([]), // array of `baz` resources | ||
} | ||
}); | ||
// register resource type 'baz' | ||
// ... | ||
} | ||
} | ||
const monkey = new CloudMonkey(); | ||
monkey.register(new FooService()); | ||
const bar = await monkey.select.one.foo.bar({ id: '1234' }); | ||
const bazs = await bar.travel.to.all.bazs(); | ||
``` | ||
CloudMonkey doesn't do any caching, i.e., if caching makes sense, the service has to take care itself. |
@@ -6,4 +6,2 @@ const assert = require('assert'); | ||
const decorate = require('./decorate'); | ||
const S3 = require('./services/S3'); | ||
const EC2 = require('./services/EC2'); | ||
const Service = require('./Service'); | ||
@@ -75,3 +73,3 @@ const { version } = require('../package.json'); | ||
} | ||
throw new Error('one resource expected but multiple found'); | ||
throw new Error('one resource expected but more than one found'); | ||
} | ||
@@ -92,2 +90,2 @@ return decorate({ | ||
module.exports = { CloudMonkey, S3, EC2 }; | ||
module.exports = CloudMonkey; |
@@ -1,1 +0,6 @@ | ||
module.exports = require('./CloudMonkey'); | ||
const CloudMonkey = require('./CloudMonkey'); | ||
const Service = require('./Service'); | ||
const S3 = require('./services/S3'); | ||
const EC2 = require('./services/EC2'); | ||
module.exports = { CloudMonkey, Service, S3, EC2 }; |
@@ -1,2 +0,2 @@ | ||
const { CloudMonkey, EC2, S3 } = require('./CloudMonkey'); | ||
const { CloudMonkey, EC2, S3 } = require('.'); | ||
@@ -3,0 +3,0 @@ const monkey = new CloudMonkey(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39051
2
14
833
186
- Removedlodash@^4.17.5
- Removedlodash@4.17.21(transitive)