0.2.2 • Published 9 years ago
clusto-client v0.2.2
A simple Javascript client for Clusto's HTTP API (clusto-apiserver).
Clusto API Server Compatibility
This library requires clusto-apiserver
version 0.4.0
or later.
Installation
npm install clusto-client
The library and its dependencies are compatible with browserify.
Usage
All API methods return Promises/A+
compatible promises via
Bluebird. Because the
clusto API can be configured to re-map all the attribute, entity, and
resource manager calls to arbitrary path prefixes, the init()
method
must be called before calling any of those API methods.
let clusto = require('clusto-client')
let client = new clusto.Client('http://clusto:9664')
client.init()
.then(() => {
client.get_from_pools({
pool: ['production', 'my-service'],
mode: clusto.Mode.EXPANDED
})
.then((entities) => {
console.log(entities)
})
})
Current Status
Work in progress.
- Packaging
- publish on npm
- localStorage caching for
__meta__
data. - error handling
- non-JSON content handling (for doc)
- unit tests
- Update for 0.4 API changes
- Main module
GET /__meta__
GET /__version__
GET /__doc__
GET /by-name/<name>
GET /by-names
GET /from-pools
GET /driverlist
Clusto-Page
,Clusto-Per-Page
in requestClusto-Pages
in response- responses that can be paged should return the data in a wrapper
that includes the value from the
Clusto-Pages
header, not just the raw body.
- responses that can be paged should return the data in a wrapper
that includes the value from the
- Attribute application
GET /atttribute/<name>
GET /atttribute/<name>/<key>
GET /atttribute/<name>/<key>/<subkey>
GET /atttribute/<name>/<key>/<subkey>/<number>
POST /atttribute/<name>
PUT /atttribute/<name>/<key>
PUT /atttribute/<name>/<key>/<subkey>
PUT /atttribute/<name>/<key>/<subkey>/<number>
DELETE /atttribute/<name>/<key>
DELETE /atttribute/<name>/<key>/<subkey>
DELETE /atttribute/<name>/<key>/<subkey>/<number>
- Entity application
GET /entity/
GET /entity/<driver>/
GET /entity/<driver>/<name>
POST /entity/<driver>
PUT /entity/<driver>/<name>
DELETE /entity/<driver>/<name>
- Resource Manager application
GET /resourcemanager/
GET /resourcemanager/<driver>
POST /resourcemanager/<driver>
GET /resourcemanager/<driver>/<manager>
POST /resourcemanager/<driver>/<manager>
DELETE /resourcemanager/<driver>/<manager>