Node client for the Rancher API
An API client is included in this package
const Rancher = require('rancher-node');
const rancher = new Rancher({
url: 'https://try.rancher.com/v2-beta/projects/XXXXXXXX/',
access_key: 'SoMeToKeN',
secret_key: 'someSecRetToken'
});
rancher.getContainer(containerId).then((container) => {
// gets the container for the provided container id
}).catch((err)=>{
console.error(' ERROR : ', err)
});
Creates a container
Gets information about a specific container
Updates a container
Stops a container
Starts a container
Restarts a container
Removes a container
Purges a container
Gets the container logs of a container
Creates a stack
Gets all stacks
Gets information about a specific stack
Gets the stack services of a stack
Removes a stack
Gets all ports
Gets all hosts
Gets information about a specific host
Deletes a host
Gets information about a specific registration token
Gets all services
Gets information about a specific service
Gets the service stats of a service
Stops a service
Starts a service
Restarts a service
Creates a service
Upgrades a service
Cancels service upgrade
Reverts service upgrade
Creates a volume
Gets information about a specific volume
Removes a volume
const Rancher = require('@pixul/node-rancher-api');
const rancher = new Rancher({
url: 'https://try.rancher.com/v2-beta/projects/XXXXXXXX/',
access_key: 'SoMeToKeN',
secret_key: 'someSecRetToken'
});
const eventApi = new Rancher.EventApi();
eventApi.on('error', err => {
console.log(err);
});
eventApi.on('resource.change.host.1h874.active', event => {
const hostId = event.data.resource.id;
});
eventApi.on('resource.change.host.1h874.transitioning', event => {
const hostId = event.data.resource.id;
});
eventApi.on('resource.change.host.1h874.active.transitioning', event => { // Will never be trigger, never
const hostId = event.data.resource.id;
});
resource.change
resource.change.<type>
resource.change.<type>.<id>
If the resource got a state
attribute set and a transitioning
value to no
resource.change.<state>
resource.change.<type>.<state>
resource.change.<type>.<id>.<state>
If the resource got transitioning
set to yes
resource.change.transitioning
resource.change.<type>.transitioning
resource.change.<type>.<id>.transitioning