docker: add options to getStats
This commit is contained in:
@@ -660,12 +660,13 @@ async function getEvents(options) {
|
||||
return stream;
|
||||
}
|
||||
|
||||
async function getStats(containerId) {
|
||||
async function getStats(containerId, options) {
|
||||
assert.strictEqual(typeof containerId, 'string');
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
const container = gConnection.getContainer(containerId);
|
||||
|
||||
const [error, result] = await safe(container.stats({ stream: false }));
|
||||
const [error, result] = await safe(container.stats({ stream: !!options.stream }));
|
||||
if (error && error.statusCode === 404) throw new BoxError(BoxError.NOT_FOUND, `Container ${containerId} not found`);
|
||||
if (error) throw new BoxError(BoxError.DOCKER_ERROR, error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user