package com.lanyuanxiaoyao.service.forest.service;

import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Query;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
import org.eclipse.collections.api.list.ImmutableList;

/**
 * @author lanyuanxiaoyao
 * @date 2023-04-23
 */
@BaseRequest(baseURL = "http://service-yarn-query")
public interface YarnService {
    @Get("/job/list")
    ImmutableList<YarnApplication> jobList(@Query("cluster") String cluster);

    @Get("/job/list_running")
    ImmutableList<YarnApplication> jobListRunning(@Query("cluster") String cluster);

    @Get("/job/list_not_running")
    ImmutableList<YarnApplication> jobListNotRunning(@Query("cluster") String cluster);

    @Get("/job/list_equals")
    ImmutableList<YarnApplication> jobListEquals(@Query("cluster") String cluster, @Query("name") String name);

    @Get("/job/list_running_equals")
    ImmutableList<YarnApplication> jobListRunningEquals(@Query("cluster") String cluster, @Query("name") String name);

    @Get("/job/list_not_running_equals")
    ImmutableList<YarnApplication> jobListNotRunningEquals(@Query("cluster") String cluster, @Query("name") String name);

    @Get("/job/list_like")
    ImmutableList<YarnApplication> jobListLike(@Query("cluster") String cluster, @Query("text") String text);

    @Get("/job/list_running_like")
    ImmutableList<YarnApplication> jobListRunningLike(@Query("cluster") String cluster, @Query("text") String text);

    @Get("/job/list_not_running_like")
    ImmutableList<YarnApplication> jobListNotRunningLike(@Query("cluster") String cluster, @Query("text") String text);

    @Get("/job/detail")
    YarnApplication jobDetail(@Query("cluster") String cluster, @Query("application_id") String applicationId);

    @Get("/queue/list")
    ImmutableList<YarnQueue> queueList(@Query("cluster") String cluster);

    @Get("/queue/detail")
    YarnQueue queueDetail(@Query("cluster") String cluster, @Query("name") String name);

    @Get("/cluster/info")
    YarnRootQueue cluster(@Query("cluster") String cluster);
}
