Beispiel #1
0
void
noit_filters_rest_init() {
  assert(noit_http_rest_register_auth(
    "GET", "/filters/", "^show(/.*)(?<=/)([^/]+)$",
    rest_show_filter, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "PUT", "/filters/", "^set(/.*)(?<=/)([^/]+)$",
    rest_set_filter, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "DELETE", "/filters/", "^delete(/.*)(?<=/)([^/]+)$",
    rest_delete_filter, noit_http_rest_client_cert_auth
  ) == 0);
}
void
stratcon_realtime_http_init(const char *toplevel) {
  eventer_name_callback("stratcon_realtime_http",
                        stratcon_realtime_http_handler);
  eventer_name_callback("stratcon_realtime_recv",
                        stratcon_realtime_recv_handler);
  assert(noit_http_rest_register_auth(
    "GET", "/data/",
           "^((?:" UUID_REGEX "(?:@\\d+)?)(?:/" UUID_REGEX "(?:@\\d+)?)*)$",
    rest_stream_data, noit_http_rest_access
  ) == 0);
  assert(noit_http_rest_register_auth(
    "GET", "/", "^(.*)$", noit_rest_simple_file_handler, noit_http_rest_access
  ) == 0);
}
void
noit_jlog_listener_init() {
  eventer_name_callback("log_transit/1.0", noit_jlog_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_JLOG_DATA_FEED,
                                 noit_jlog_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_JLOG_DATA_TEMP_FEED,
                                 noit_jlog_handler);
  assert(noit_http_rest_register_auth(
    "GET", "/", "^feed$",
    rest_show_feed, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "DELETE", "/feed/", "^(.+)$",
    rest_delete_feed, noit_http_rest_client_cert_auth
  ) == 0);
}
void
noit_events_rest_init() {
  assert(noit_http_rest_register_auth(
    "GET", "/eventer/", "^sockets\\.json$",
    noit_rest_eventer_sockets, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "GET", "/eventer/", "^timers\\.json$",
    noit_rest_eventer_timers, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "GET", "/eventer/", "^jobq\\.json$",
    noit_rest_eventer_jobq, noit_http_rest_client_cert_auth
  ) == 0);
  assert(noit_http_rest_register_auth(
    "GET", "/eventer/", "^logs/(.+)\\.json$",
    noit_rest_eventer_logs, noit_http_rest_client_cert_auth
  ) == 0);
}
void
stratcon_datastore_init() {
  static int initialized = 0;
  if(initialized) return;
  initialized = 1;
  stratcon_datastore_core_init();

  stratcon_ingest_sweep_journals(is_raw_ingestion_file,
                                 stratcon_ingest);

  assert(noit_http_rest_register_auth(
    "GET", "/noits/", "^config$", rest_get_noit_config,
             noit_http_rest_client_cert_auth
  ) == 0);
}
static int handoff_ingestor_init(noit_module_generic_t *self) {
  ds_err = noit_log_stream_find("error/datastore");
  ds_deb = noit_log_stream_find("debug/datastore");
  ingest_err = noit_log_stream_find("error/ingest");
  if(!ds_err) ds_err = noit_error;
  if(!ingest_err) ingest_err = noit_error;
  if(!noit_conf_get_string(NULL, "/stratcon/database/journal/path",
                           &basejpath)) {
    noitL(noit_error, "/stratcon/database/journal/path is unspecified\n");
    exit(-1);
  }
  noitL(noit_error, "registering /handoff/journals REST endpoint\n");
  assert(noit_http_rest_register_auth(
    "GET", "/handoff/", "^journals$", handoff_stream,
    noit_http_rest_client_cert_auth
  ) == 0);
  return stratcon_datastore_set_ingestor(&handoff_ingestor_api);
}
Beispiel #7
0
int
noit_http_rest_register(const char *method, const char *base,
                        const char *expr, rest_request_handler f) {
  return noit_http_rest_register_auth(method, base, expr, f, NULL);
}