mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
19.29.2022 9926a79503c9bd6454c076f2b60cd577f6061e4d
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
package de.micromata.borgbutler.server.rest
 
import de.micromata.borgbutler.BorgQueueExecutor
import de.micromata.borgbutler.json.JsonUtils
import de.micromata.borgbutler.server.BorgInstallation
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
 
@RestController
@RequestMapping("/rest/system")
class SystemInfoRest {
    /**
     * @return The total number of jobs queued or running (and other statistics): [de.micromata.borgbutler.BorgQueueStatistics].
     * @see JsonUtils.toJson
     */
    @GetMapping("info")
    fun statistics(): SystemInfo {
        val borgConfig = BorgInstallation.getInstance().borgConfig
        val systemInfo = SystemInfo()
            .setQueueStatistics(BorgQueueExecutor.getInstance().statistics)
            .setConfigurationOK(borgConfig.isVersionOK)
            .setBorgConfig(borgConfig)
        return systemInfo
    }
}