node-docker-api
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -37,2 +37,9 @@ import Modem = require('docker-modem'); | ||
remove(opts?: Object): Promise<String>; | ||
/** | ||
* Logs of a service | ||
* https://docs.docker.com/engine/api/v1.27/#operation/ServiceLogs | ||
* @param {Object} opts Query params in the request (optional) | ||
* @return {Promise} Promise return the result | ||
*/ | ||
logs(opts?: Object): Promise<String>; | ||
} | ||
@@ -39,0 +46,0 @@ export default class { |
@@ -96,2 +96,30 @@ 'use strict'; | ||
} | ||
/** | ||
* Logs of a service | ||
* https://docs.docker.com/engine/api/v1.27/#operation/ServiceLogs | ||
* @param {Object} opts Query params in the request (optional) | ||
* @return {Promise} Promise return the result | ||
*/ | ||
logs(opts) { | ||
const call = { | ||
path: `/services/${this.id}/logs?`, | ||
method: 'GET', | ||
options: opts, | ||
statusCodes: { | ||
101: true, | ||
200: true, | ||
404: 'no such service', | ||
500: 'server error', | ||
501: 'use --experimental to see this', | ||
503: 'node is not part of a swarm' | ||
} | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this.modem.dial(call, (err, res) => { | ||
if (err) | ||
return reject(err); | ||
resolve(res); | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -98,0 +126,0 @@ exports.Service = Service; |
{ | ||
"name": "node-docker-api", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Docker Remote API driver for node", | ||
@@ -5,0 +5,0 @@ "main": "./lib/docker", |
@@ -105,2 +105,31 @@ 'use strict' | ||
} | ||
/** | ||
* Logs of a service | ||
* https://docs.docker.com/engine/api/v1.27/#operation/ServiceLogs | ||
* @param {Object} opts Query params in the request (optional) | ||
* @return {Promise} Promise return the result | ||
*/ | ||
logs (opts?: Object): Promise<String> { | ||
const call = { | ||
path: `/services/${this.id}/logs?`, | ||
method: 'GET', | ||
options: opts, | ||
statusCodes: { | ||
101: true, | ||
200: true, | ||
404: 'no such service', | ||
500: 'server error', | ||
501: 'use --experimental to see this', | ||
503: 'node is not part of a swarm' | ||
} | ||
} | ||
return new Promise((resolve, reject) => { | ||
this.modem.dial(call, (err, res: String) => { | ||
if (err) return reject(err) | ||
resolve(res) | ||
}) | ||
}) | ||
} | ||
} | ||
@@ -107,0 +136,0 @@ |
@@ -108,2 +108,7 @@ import test from 'ava' | ||
}) | ||
test('logs-service', async t => { | ||
const res = await (await createService()).logs({stdout: true}) | ||
t.is(res.constructor, String) | ||
}) | ||
@@ -110,0 +115,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
393717
7377