Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function RequestCaptureStream(opts) {
assert.object(opts, 'options');
assert.optionalObject(opts.stream, 'options.stream');
assert.optionalArrayOfObject(opts.streams, 'options.streams');
assert.optionalNumber(opts.level, 'options.level');
assert.optionalNumber(opts.maxRecords, 'options.maxRecords');
assert.optionalNumber(opts.maxRequestIds, 'options.maxRequestIds');
assert.optionalBool(opts.dumpDefault, 'options.dumpDefault');
var self = this;
Stream.call(this);
this.level = opts.level ? bunyan.resolveLevel(opts.level) : bunyan.WARN;
this.limit = opts.maxRecords || 100;
this.maxRequestIds = opts.maxRequestIds || 1000;
// eslint-disable-next-line new-cap
this.requestMap = LRU({
max: self.maxRequestIds
});
this.dumpDefault = opts.dumpDefault;
Parser.prototype.help = function help(config) {
config = config || {};
assert.object(config, 'config');
var indent = makeIndent(config.indent, 4, 'config.indent');
var headingIndent = makeIndent(config.headingIndent,
Math.round(indent.length / 2), 'config.headingIndent');
assert.optionalString(config.nameSort, 'config.nameSort');
var nameSort = config.nameSort || 'length';
assert.ok(~['length', 'none'].indexOf(nameSort),
'invalid "config.nameSort"');
assert.optionalNumber(config.maxCol, 'config.maxCol');
assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol');
assert.optionalNumber(config.minHelpCol, 'config.minHelpCol');
assert.optionalNumber(config.helpCol, 'config.helpCol');
assert.optionalBool(config.includeEnv, 'config.includeEnv');
assert.optionalBool(config.includeDefault, 'config.includeDefault');
assert.optionalBool(config.helpWrap, 'config.helpWrap');
var maxCol = config.maxCol || 80;
var minHelpCol = config.minHelpCol || 20;
var maxHelpCol = config.maxHelpCol || 40;
var lines = [];
var maxWidth = 0;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
if (o.group !== undefined && o.group !== null) {
// We deal with groups in the next pass
function create(model) {
assert.string(model.host, 'model.host');
assert.optionalNumber(model.port, 'model.port');
assert.optionalObject(model.headers, 'model.headers');
var remoteHost = new Urijs(model.host)
.port(model.port || 80)
.protocol(model.secure ? 'https' : 'http')
.toString();
return restify.createJsonClient({
url: remoteHost,
// TODO: this doesn't seem to log anything?!
log: logHelpers.child({ component: 'jsonClient' })
});
}
if (err) {
callback(err, null, res);
} else {
callback(null, image, res);
}
});
});
return;
}
// Normal file/stream AddImageFile
assert.string(options.compression, 'options.compression');
assert.ok(['string', 'object'].indexOf(typeof (options.file)) !== -1,
'options.file');
assert.optionalString(options.sha1, 'options.sha1');
assert.optionalNumber(options.size, 'options.size');
assert.optionalString(account, 'account');
var file = options.file;
function getFileStreamAndSize(next) {
if (typeof (file) === 'object') {
assert.number(options.size, 'options.size');
return next(null, file, options.size);
} else if (options.size) {
var stream = fs.createReadStream(file);
pauseStream(stream);
return next(null, stream, options.size);
} else {
return fs.stat(file, function (statErr, stats) {
if (statErr) {
return next(statErr);
}
Parser.prototype.help = function help(config) {
config = config || {};
assert.object(config, 'config');
var indent = makeIndent(config.indent, 4, 'config.indent');
var headingIndent = makeIndent(config.headingIndent,
Math.round(indent.length / 2), 'config.headingIndent');
assert.optionalString(config.nameSort, 'config.nameSort');
var nameSort = config.nameSort || 'length';
assert.ok(~['length', 'none'].indexOf(nameSort),
'invalid "config.nameSort"');
assert.optionalNumber(config.maxCol, 'config.maxCol');
assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol');
assert.optionalNumber(config.minHelpCol, 'config.minHelpCol');
assert.optionalNumber(config.helpCol, 'config.helpCol');
assert.optionalBool(config.includeEnv, 'config.includeEnv');
assert.optionalBool(config.includeDefault, 'config.includeDefault');
assert.optionalBool(config.helpWrap, 'config.helpWrap');
var maxCol = config.maxCol || 80;
var minHelpCol = config.minHelpCol || 20;
var maxHelpCol = config.maxHelpCol || 40;
var lines = [];
var maxWidth = 0;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
if (o.group !== undefined && o.group !== null) {
function ImgadmError(options) {
assert.object(options, 'options');
assert.string(options.message, 'options.message');
assert.string(options.code, 'options.code');
assert.optionalObject(options.cause, 'options.cause');
assert.optionalNumber(options.statusCode, 'options.statusCode');
var self = this;
var args = [];
if (options.cause) args.push(options.cause);
if (options.message) {
args.push('%s');
args.push(options.message);
}
WError.apply(this, args);
var extra = Object.keys(options).filter(
function (k) { return ['cause', 'message'].indexOf(k) === -1; });
extra.forEach(function (k) {
self[k] = options[k];
});
}
function SyslogStream(opts) {
assert.object(opts, 'options');
assert.optionalNumber(opts.facility, 'options.facility');
assert.optionalString(opts.name, 'options.name');
Stream.call(this);
this.facility = opts.facility || 1;
this.name = opts.name || process.title || process.argv[0];
this.writable = true;
if (this.constructor.name === 'SyslogStream') {
binding.openlog(this.name, binding.LOG_CONS, 0);
process.nextTick(this.emit.bind(this, 'connect'));
}
}
util.inherits(SyslogStream, Stream);
Parser.prototype.help = function help(config) {
config = config || {};
assert.object(config, 'config');
var indent = makeIndent(config.indent, 4, 'config.indent');
var headingIndent = makeIndent(config.headingIndent,
Math.round(indent.length / 2), 'config.headingIndent');
assert.optionalString(config.nameSort, 'config.nameSort');
var nameSort = config.nameSort || 'length';
assert.ok(~['length', 'none'].indexOf(nameSort),
'invalid "config.nameSort"');
assert.optionalNumber(config.maxCol, 'config.maxCol');
assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol');
assert.optionalNumber(config.minHelpCol, 'config.minHelpCol');
assert.optionalNumber(config.helpCol, 'config.helpCol');
assert.optionalBool(config.includeEnv, 'config.includeEnv');
assert.optionalBool(config.includeDefault, 'config.includeDefault');
assert.optionalBool(config.helpWrap, 'config.helpWrap');
var maxCol = config.maxCol || 80;
var minHelpCol = config.minHelpCol || 20;
var maxHelpCol = config.maxHelpCol || 40;
var lines = [];
var maxWidth = 0;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
if (o.group !== undefined && o.group !== null) {
function vmWaitForState(uuid, options, callback) {
assert.string(uuid, 'uuid');
assert.object(options, 'options');
assert.string(options.state, 'options.state');
assert.optionalNumber(options.timeout, 'options.timeout');
assert.optionalNumber(options.interval, 'options.interval');
assert.object(options.log, 'options.log');
assert.func(callback);
var interval = options.interval || 1000;
var start = Date.now();
var vm;
async.doUntil(
function getIt(next) {
setTimeout(function () {
vmGet(uuid, options, function (err, vm_) {
vm = vm_;
next(err);
});
}, interval);
},
function testIt() {