tutum is a wrapper around Tutum's API for Node.js.
$ npm install tutum
First you need to add a reference to tutum in your application.
const Tutum = require('tutum');
Then, you need to call the Tutum
constructor function to create a new instance. For that you need to specify your username and your API key. For details on where to get them, see the Tutum documentation.
const tutum = new Tutum({
username: '...',
apiKey: '...'
});
Now you can perform GET
, POST
, PATCH
and DELETE
requests against the Tutum API using the following helper functions.
tutum.get(path, options, (err, res) => {
// ...
});
tutum.post(path, options, (err, res) => {
// ...
});
tutum.patch(path, options, (err, res) => {
// ...
});
tutum.delete(path, options, (err, res) => {
// ...
});
Refer to the Tutum documentation to find the appropriate method and path for your request. The following two samples basically show how to use the API.
// List all successful actions (https://docs.tutum.co/v2/api/#list-all-actions)
tutum.get('/action', { state: 'Success' }, (err, res) => {
// ...
});
// Start a container (https://docs.tutum.co/v2/api/#start-a-container)
tutum.post('/container/[UUID]/start', (err, res) => {
// ...
});
Please also have a look at the examples folder for a real-world example.
To build this module use roboter.
$ bot build-server
The MIT License (MIT) Copyright (c) 2014-2016 the native web.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.