Comparing version 2.3.0 to 2.3.1
@@ -47,18 +47,3 @@ var extend = require('./util').extend, | ||
if (typeof args.callback === 'function') { | ||
var optsf = { | ||
path: '/containers/' + this.id + '/json?', | ||
method: 'GET', | ||
options: args.opts, | ||
statusCodes: { | ||
200: true, | ||
404: 'no such container', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(optsf, function(err, data) { | ||
args.callback(err, data); | ||
}); | ||
} else { | ||
if (typeof args.callback !== 'function') { | ||
return JSON.stringify({ | ||
@@ -68,2 +53,17 @@ id: this.id | ||
} | ||
var optsf = { | ||
path: '/containers/' + this.id + '/json?', | ||
method: 'GET', | ||
options: args.opts, | ||
statusCodes: { | ||
200: true, | ||
404: 'no such container', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(optsf, function(err, data) { | ||
args.callback(err, data); | ||
}); | ||
}; | ||
@@ -630,7 +630,10 @@ | ||
var args = util.processArgs(opts, callback, this.defaultOptions.stats); | ||
var isStream = true; | ||
if (args.opts.stream == false) { | ||
isStream = false; | ||
} | ||
var optsf = { | ||
path: '/containers/' + this.id + '/stats?', | ||
method: 'GET', | ||
isStream: true, | ||
isStream: isStream, | ||
statusCodes: { | ||
@@ -637,0 +640,0 @@ 200: true, |
@@ -411,5 +411,8 @@ var EventEmitter = require('events').EventEmitter, | ||
*/ | ||
Docker.prototype.createService = function(opts, callback) { | ||
var args = util.processArgs(opts, callback); | ||
Docker.prototype.createService = function(auth, opts, callback) { | ||
if (!callback && typeof opts === 'function') { | ||
callback = opts; | ||
opts = auth; | ||
auth = opts.authconfig || undefined; | ||
} | ||
var self = this; | ||
@@ -419,3 +422,4 @@ var optsf = { | ||
method: 'POST', | ||
options: args.opts, | ||
options: opts, | ||
authconfig: auth, | ||
statusCodes: { | ||
@@ -429,5 +433,5 @@ 200: true, | ||
this.modem.dial(optsf, function(err, data) { | ||
if (err) return args.callback(err, data); | ||
if (err) return callback(err, data); | ||
args.callback(err, self.getService(data.ID || data.Id)); | ||
callback(err, self.getService(data.ID || data.Id)); | ||
}); | ||
@@ -807,3 +811,3 @@ }; | ||
var optsf = { | ||
path: '/swarm/update', | ||
path: '/swarm/update?', | ||
method: 'POST', | ||
@@ -824,2 +828,24 @@ statusCodes: { | ||
/** | ||
* Inspect a Swarm. | ||
* Warning: This method is not documented in the API | ||
* | ||
* @param {Function} callback Callback | ||
*/ | ||
Docker.prototype.swarmInspect = function(callback) { | ||
var optsf = { | ||
path: '/swarm', | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
406: 'This node is not a swarm manager', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(optsf, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}; | ||
module.exports = Docker; |
@@ -74,2 +74,8 @@ var util = require('./util'); | ||
Exec.prototype.inspect = function(callback) { | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
id: this.id | ||
}); | ||
} | ||
var optsf = { | ||
@@ -76,0 +82,0 @@ path: '/exec/' + this.id + '/json', |
@@ -19,19 +19,21 @@ var util = require('./util'); | ||
Image.prototype.inspect = function(callback) { | ||
if (typeof callback === 'function') { | ||
var opts = { | ||
path: '/images/' + this.name + '/json', | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such image', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
name: this.name | ||
}); | ||
} else { | ||
return JSON.stringify({name: this.name}); | ||
} | ||
var opts = { | ||
path: '/images/' + this.name + '/json', | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such image', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}; | ||
@@ -38,0 +40,0 @@ |
@@ -19,19 +19,21 @@ var util = require('./util'); | ||
Network.prototype.inspect = function(callback) { | ||
if (typeof callback === 'function') { | ||
var opts = { | ||
path: '/networks/' + this.id, | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such network', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
Id: this.id | ||
}); | ||
} else { | ||
return JSON.stringify({Id: this.id}); | ||
} | ||
var opts = { | ||
path: '/networks/' + this.id, | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such network', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}; | ||
@@ -38,0 +40,0 @@ |
@@ -20,2 +20,8 @@ var util = require('./util'); | ||
Node.prototype.inspect = function(callback) { | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
id: this.id | ||
}); | ||
} | ||
var optsf = { | ||
@@ -37,2 +43,32 @@ path: '/nodes/' + this.id, | ||
/** | ||
* Remove a Node. | ||
* Warning: This method is not documented in the API. | ||
* | ||
* @param {object} options | ||
* @param {function} callback | ||
*/ | ||
Node.prototype.remove = function(callback) { | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
id: this.id | ||
}); | ||
} | ||
var optsf = { | ||
path: '/nodes/' + this.id, | ||
method: 'DELETE', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such node', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(optsf, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}; | ||
module.exports = Node; |
@@ -20,2 +20,8 @@ var util = require('./util'); | ||
Service.prototype.inspect = function(callback) { | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
id: this.id | ||
}); | ||
} | ||
var optsf = { | ||
@@ -64,5 +70,8 @@ path: '/services/' + this.id, | ||
*/ | ||
Service.prototype.update = function(opts, callback) { | ||
var args = util.processArgs(opts, callback); | ||
Service.prototype.update = function(auth, opts, callback) { | ||
if (!callback && typeof opts === 'function') { | ||
callback = opts; | ||
opts = auth; | ||
auth = opts.authconfig || undefined; | ||
} | ||
var optsf = { | ||
@@ -76,7 +85,7 @@ path: '/services/' + this.id + '/update?', | ||
}, | ||
options: args.opts | ||
authconfig: auth, | ||
options: opts | ||
}; | ||
this.modem.dial(optsf, function(err, data) { | ||
args.callback(err, data); | ||
callback(err, data); | ||
}); | ||
@@ -83,0 +92,0 @@ }; |
@@ -20,6 +20,10 @@ var util = require('./util'); | ||
Task.prototype.inspect = function(callback) { | ||
var args = util.processArgs(opts, callback); | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
id: this.id | ||
}); | ||
} | ||
var optsf = { | ||
path: '/nodes/' + this.id, | ||
path: '/tasks/' + this.id, | ||
method: 'GET', | ||
@@ -34,3 +38,3 @@ statusCodes: { | ||
this.modem.dial(optsf, function(err, data) { | ||
args.callback(err, data); | ||
callback(err, data); | ||
}); | ||
@@ -37,0 +41,0 @@ }; |
var util = require('./util'); | ||
/** | ||
* Represents an volume | ||
* Represents a volume | ||
* @param {Object} modem docker-modem | ||
@@ -19,19 +19,21 @@ * @param {String} name Volume's name | ||
Volume.prototype.inspect = function(callback) { | ||
if (typeof callback === 'function') { | ||
var opts = { | ||
path: '/volumes/' + this.name, | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such volume', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
if (typeof callback !== 'function') { | ||
return JSON.stringify({ | ||
name: this.name | ||
}); | ||
} else { | ||
return JSON.stringify({name: this.name}); | ||
} | ||
var opts = { | ||
path: '/volumes/' + this.name, | ||
method: 'GET', | ||
statusCodes: { | ||
200: true, | ||
404: 'no such volume', | ||
500: 'server error' | ||
} | ||
}; | ||
this.modem.dial(opts, function(err, data) { | ||
callback(err, data); | ||
}); | ||
}; | ||
@@ -38,0 +40,0 @@ |
{ | ||
"name": "dockerode", | ||
"description": "Docker Remote API module.", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"author": "Pedro Dias <petermdias@gmail.com>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64578
1949