Skip to content

Commit

Permalink
Host endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Mar 23, 2017
1 parent a4a58c9 commit e599a7f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ one.createVM('GRAPHICS=[TYPE="vnc",LISTEN="0.0.0.0"]\nMEMORY="1024"\n FROM_APP="
* vm.resize(template, enforce, callback)
* vm.update(template, replace, callback)
* vm.recover(recover, callback)
* vm.migrate(host, live, enforce, datastore, callback)
* vm.saveAsDisk(disk, imagename, imagetype, snapshot, callback)
* vm.createDiskSnapshot(disk, snapshot, callback)
* vm.updateConf(template, callback)
* vm.revertDiskSnapshot(disk, snapshot, callback)
* vm.deleteDiskSnapshot(disk, snapshot, callback)

### Datastore

Expand Down Expand Up @@ -192,6 +198,9 @@ one.createVM('GRAPHICS=[TYPE="vnc",LISTEN="0.0.0.0"]\nMEMORY="1024"\n FROM_APP="
* host.update(template, merge, callback)
* host.delete(callback)
* host.rename(name, callback)
* monitoring(callback)
* allocate(hostname, manager, vm, cluster, callback)
* setStatus(status, callback)

### Image

Expand Down
21 changes: 21 additions & 0 deletions lib/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Host.prototype.enable = function(callback) {
});
};

Host.prototype.monitoring = function(callback) {
this.modem.call('host.monitoring', [this.id], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

Host.prototype.disable = function(callback) {
this.modem.call('host.enable', [this.id, false], function(err, data) {
if(err) return callback(err);
Expand All @@ -31,13 +38,27 @@ Host.prototype.update = function(template, merge, callback) {
});
};

Host.prototype.allocate = function(hostname, manager, vm, cluster, callback) {
this.modem.call('host.allocate', [this.id, hostname, manager, vm, cluster], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

Host.prototype.delete = function(callback) {
this.modem.call('host.delete', [this.id], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

Host.prototype.setStatus = function(status, callback) {
this.modem.call('host.status', [this.id, status], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

Host.prototype.rename = function(name, callback) {
this.modem.call('host.rename', [this.id, name], function(err, data) {
if(err) return callback(err);
Expand Down

0 comments on commit e599a7f

Please sign in to comment.