tutum is a wrapper around Tutum's API for Node.js.
$ npm install tutum
The first thing you need to do is to integrate tutum in your application.
var tutum = require('tutum');
Then you need to authenticate using your username and your API key. See the Tutum documentation if you don't know how to get that key.
tutum.authenticate({ username: 'foo', apiKey: 'bar' }, function (err, cloud) {
// ...
});
The cloud
object that is returned then gives you access to all of Tutum's functionality.
To get a list of applications, call the getApplications
function.
cloud.getApplications(function (err, applications, metadata) {
// ...
});
Optionally, you can provide query criteria.
cloud.getApplications({ limit: 10 }, function (err, applications, metadata) {
// ...
});
For details see the Tutum API documentation.
To get details for an applications, call the getApplicationDetails
function.
cloud.getApplicationDetails(applicationId, function (err, details) {
// ...
});
For details see the Tutum API documentation.
To create a new application, call the createApplication
function.
cloud.createApplication({ image: 'tutum/hello-world' }, function (err, details) {
// ...
});
For details see the Tutum API documentation.
To update an application, call the updateApplication
function.
cloud.updateApplication(applicationId, { target_num_containers: 2 }, function (err, details) {
// ...
});
For details see the Tutum API documentation.
To start an application, call the startApplication
function.
cloud.startApplication(applicationId, function (err, details) {
// ...
});
For details see the Tutum API documentation.
To stop an application, call the stopApplication
function.
cloud.stopApplication(applicationId, function (err, details) {
// ...
});
For details see the Tutum API documentation.
To terminate an application, call the terminateApplication
function.
cloud.terminateApplication(applicationId, function (err, details) {
// ...
});
For details see the Tutum API documentation.
This module can be built using Grunt. Besides running the tests, Grunt also analyses the code using JSHint. To run Grunt, go to the folder where you have installed tutum-node and run grunt
. You need to have grunt-cli installed.
$ grunt
Please note that for the tests to work you need a Tutum account. Add a file with the name credentials.json
to the test
directory and deposit your credentials in the following format:
{
"username": "foo",
"apiKey": "bar"
}
The file .gitignore
contains a rule that excludes this file from being committed.
The MIT License (MIT) Copyright (c) 2014 Golo Roden.
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.