forked from parseablehq/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster.ts
29 lines (24 loc) · 892 Bytes
/
cluster.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Ingestor, IngestorMetrics, IngestorQueryRecord } from '@/@types/parseable/api/clusterInfo';
import { Axios } from './axios';
import { CLUSTER_INFO_URL, CLUSTER_METRICS_URL, INGESTOR_DELETE_URL, LOG_QUERY_URL } from './constants';
export const getClusterInfo = () => {
return Axios().get<Ingestor[]>(CLUSTER_INFO_URL);
};
export const getIngestorInfo = (domain_name: string | null, startTime: Date, endTime: Date) => {
const query = `SELECT * FROM pmeta where address = '${domain_name}' ORDER BY event_time DESC LIMIT 10 OFFSET 0`;
return Axios().post<IngestorQueryRecord[]>(
LOG_QUERY_URL(),
{
query,
startTime,
endTime,
},
{},
);
};
export const getClusterMetrics = () => {
return Axios().get<IngestorMetrics[]>(CLUSTER_METRICS_URL);
};
export const deleteIngestor = (ingestorUrl: string) => {
return Axios().delete(INGESTOR_DELETE_URL(ingestorUrl));
};