MonitorController.java 1.05 KB
package vion.controller.mqtt;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.model.Agent;
import vion.model.ServerInfo;
import vion.model.ServiceRecord;
import vion.model.Upgrade;
import vion.service.IAgentService;

import java.util.List;

/**
 * @author vion
 * @date 2024/10/16
 */
@RestController
@RequestMapping("/api/monitor")
@RequiredArgsConstructor
public class MonitorController {

    private final IAgentService agentService;

    @PostMapping("/reg")
    public String reg(@RequestBody Agent agent) {
        return agentService.reg(agent);
    }

    @GetMapping("/upgrade")
    public Upgrade getUpgradeInfo(Short type) {
        return agentService.getUpgradeInfo(type);
    }

    @PostMapping("/server")
    public String recServerInfo(@RequestBody ServerInfo serverInfo) {
        return agentService.recServerInfo(serverInfo);
    }

    @PostMapping("/service")
    public String recServiceInfo(@RequestBody List<ServiceRecord> recList) {
        return agentService.recServiceInfo(recList);
    }
}