Files
komodo/core/src/util/periphery/server.ts
T
2022-05-12 14:04:56 -04:00

34 lines
946 B
TypeScript

import { CommandLogError, DockerStat, Server, SystemStats } from "@monitor/types";
import axios from "axios";
import { SECRETS } from "../../config";
export async function prunePeripheryImages({ address, passkey }: Server) {
return await axios
.get<CommandLogError>(`${address}/images/prune`, {
headers: {
Authorization: passkey || SECRETS.PASSKEY,
},
})
.then(({ data }) => data);
}
export async function getPeripheryDockerStats({ address, passkey }: Server) {
return await axios
.get<DockerStat[]>(`${address}/stats`, {
headers: {
Authorization: passkey || SECRETS.PASSKEY,
},
})
.then(({ data }) => data);
}
export async function getPeripherySystemStats({ address, passkey }: Server) {
return await axios
.get<SystemStats>(`${address}/sys-stats`, {
headers: {
Authorization: passkey || SECRETS.PASSKEY,
},
})
.then(({ data }) => data);
}