fleet/frontend/kolide/index.js
Zachary Wasserman 1eccf9a874
Add warning in query UI when Redis fails (#2086)
- Add warning message when Redis fails
- Disable query button when Redis fails
- Refactor SMTP warning banner into component for reuse

Closes #2073
2019-08-13 09:42:58 -07:00

70 lines
2.3 KiB
JavaScript

import Base from 'kolide/base';
import Request from 'kolide/request';
import accountMethods from 'kolide/entities/account';
import configMethods from 'kolide/entities/config';
import hostMethods from 'kolide/entities/hosts';
import inviteMethods from 'kolide/entities/invites';
import labelMethods from 'kolide/entities/labels';
import packMethods from 'kolide/entities/packs';
import queryMethods from 'kolide/entities/queries';
import scheduledQueryMethods from 'kolide/entities/scheduled_queries';
import sessionMethods from 'kolide/entities/sessions';
import statusLabelMethods from 'kolide/entities/status_labels';
import targetMethods from 'kolide/entities/targets';
import userMethods from 'kolide/entities/users';
import websocketMethods from 'kolide/websockets';
import statusMethods from 'kolide/status';
const DEFAULT_BODY = JSON.stringify({});
class Kolide extends Base {
constructor () {
super();
this.account = accountMethods(this);
this.config = configMethods(this);
this.hosts = hostMethods(this);
this.invites = inviteMethods(this);
this.labels = labelMethods(this);
this.packs = packMethods(this);
this.queries = queryMethods(this);
this.scheduledQueries = scheduledQueryMethods(this);
this.sessions = sessionMethods(this);
this.statusLabels = statusLabelMethods(this);
this.targets = targetMethods(this);
this.users = userMethods(this);
this.websockets = websocketMethods(this);
this.status = statusMethods(this);
}
authenticatedDelete (endpoint, overrideHeaders = {}) {
const headers = this._authenticatedHeaders(overrideHeaders);
return Base._deleteRequest(endpoint, headers);
}
authenticatedGet (endpoint, overrideHeaders = {}) {
const { GET } = Request.REQUEST_METHODS;
return this._authenticatedRequest(GET, endpoint, {}, overrideHeaders);
}
authenticatedPatch (endpoint, body = {}, overrideHeaders = {}) {
const { PATCH } = Request.REQUEST_METHODS;
return this._authenticatedRequest(PATCH, endpoint, body, overrideHeaders);
}
authenticatedPost (endpoint, body = DEFAULT_BODY, overrideHeaders = {}) {
const { POST } = Request.REQUEST_METHODS;
return this._authenticatedRequest(POST, endpoint, body, overrideHeaders);
}
setBearerToken (bearerToken) {
this.bearerToken = bearerToken;
}
}
export default new Kolide();