Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!opts.baseUrl) {
opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' +
(opts.host || '127.0.0.1') + ':' +
(opts.port || 8500) + '/v1';
}
opts.name = 'consul';
opts.type = 'json';
if (opts.defaults) {
var defaults = utils.defaultCommonOptions(opts.defaults);
if (defaults) this._defaults = defaults;
}
delete opts.defaults;
papi.Client.call(this, opts);
this.acl = new Consul.Acl(this);
this.agent = new Consul.Agent(this);
this.catalog = new Consul.Catalog(this);
this.event = new Consul.Event(this);
this.health = new Consul.Health(this);
this.kv = new Consul.Kv(this);
this.query = new Consul.Query(this);
this.session = new Consul.Session(this);
this.status = new Consul.Status(this);
try {
if (opts.promisify) {
if (typeof opts.promisify === 'function') {
papi.tools.promisify(this, opts.promisify);
} else {
try {
if (opts.promisify) {
if (typeof opts.promisify === 'function') {
papi.tools.promisify(this, opts.promisify);
} else {
papi.tools.promisify(this);
}
}
} catch (err) {
err.message = 'promisify: ' + err.message;
throw err;
}
}
util.inherits(Consul, papi.Client);
Consul.Acl = Acl;
Consul.Agent = Agent;
Consul.Catalog = Catalog;
Consul.Event = Event;
Consul.Health = Health;
Consul.Kv = Kv;
Consul.Lock = Lock;
Consul.Query = Query;
Consul.Session = Session;
Consul.Status = Status;
Consul.Watch = Watch;
/**
* Object meta
*/
try {
if (opts.promisify) {
if (typeof opts.promisify === 'function') {
papi.tools.promisify(this, opts.promisify);
} else {
papi.tools.promisify(this);
}
}
} catch (err) {
err.message = 'promisify: ' + err.message;
throw err;
}
}
util.inherits(Jenkins, papi.Client);
Jenkins.Build = Build;
Jenkins.CrumbIssuer = CrumbIssuer;
Jenkins.Job = Job;
Jenkins.Label = Label;
Jenkins.Node = Node;
Jenkins.Queue = Queue;
Jenkins.View = View;
/**
* Object meta
*/
Jenkins.meta = {};
/**
if (typeof opts.crumbIssuer === 'function') {
this._crumbIssuer = opts.crumbIssuer;
delete opts.crumbIssuer;
} else if (opts.crumbIssuer === true) {
this._crumbIssuer = utils.crumbIssuer;
}
if (opts.formData) {
if (typeof opts.formData !== 'function' || opts.formData.name !== 'FormData') {
throw new Error('formData is invalid');
}
this._formData = opts.formData;
delete opts.formData;
}
papi.Client.call(this, opts);
this._ext('onCreate', this._onCreate);
this._ext('onResponse', this._onResponse);
this.build = new Jenkins.Build(this);
this.crumbIssuer = new Jenkins.CrumbIssuer(this);
this.job = new Jenkins.Job(this);
this.label = new Jenkins.Label(this);
this.node = new Jenkins.Node(this);
this.queue = new Jenkins.Queue(this);
this.view = new Jenkins.View(this);
try {
if (opts.promisify) {
if (typeof opts.promisify === 'function') {
papi.tools.promisify(this, opts.promisify);