aboutsummaryrefslogtreecommitdiff
path: root/kamon-status/src/api/StatusApi.ts
blob: 540c1c531eb1ca2395ca1e86cbb24998a3bc5123 (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
import axios, { AxiosResponse } from 'axios'

export interface Environment {
  service: string
  host: string
  instance: string
  tags: { [key: string]: string }
}

export interface BaseInfo {
  version: string
  environment: Environment
  config: any
}

export interface Module {
  name: string
  description: string
  enabled: boolean
  started: boolean
}

export interface ModuleRegistryStatus {
  modules: Array<Module>
}


export class StatusApi {

  public baseInfo(): Promise<BaseInfo> {
    return axios.get("/status/base-info").then(response => {
      return response.data as BaseInfo
    })
  }

  public moduleRegistryStatus(): Promise<ModuleRegistryStatus> {
    return axios.get("/status/modules").then(response => {
      return response.data as ModuleRegistryStatus
    })
  }
}