package com.lanyuanxiaoyao.service.yarn.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
import com.lanyuanxiaoyao.service.yarn.service.ClusterService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Cluster
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-23
 */
@RestController
@RequestMapping("cluster")
public class ClusterController {
    private static final Logger logger = LoggerFactory.getLogger(ClusterController.class);

    private final ClusterService clusterService;

    public ClusterController(ClusterService clusterService) {
        this.clusterService = clusterService;
    }

    @GetMapping("info")
    public YarnRootQueue info(@RequestParam("cluster") String cluster) throws JsonProcessingException {
        return clusterService.info(cluster);
    }
}
