mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-05-25 11:10:20 +00:00
96 lines
2.2 KiB
Go
96 lines
2.2 KiB
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type PluginHandlers struct {
|
|
adminServer interface{}
|
|
pluginMgr interface{}
|
|
}
|
|
|
|
func NewPluginHandlers(adminServer interface{}, pluginMgr interface{}) *PluginHandlers {
|
|
return &PluginHandlers{
|
|
adminServer: adminServer,
|
|
pluginMgr: pluginMgr,
|
|
}
|
|
}
|
|
|
|
// ListPluginsAPI returns list of connected plugins
|
|
func (h *PluginHandlers) ListPluginsAPI(c *gin.Context) {
|
|
result := []map[string]interface{}{}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// ListJobsAPI returns jobs for a specific type
|
|
func (h *PluginHandlers) ListJobsAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]interface{}{
|
|
"job_type": jobType,
|
|
"jobs": []interface{}{},
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// GetConfigAPI returns configuration for a job type
|
|
func (h *PluginHandlers) GetConfigAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]interface{}{
|
|
"type": jobType,
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// SaveConfigAPI saves configuration for a job type
|
|
func (h *PluginHandlers) SaveConfigAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]string{
|
|
"status": "saved",
|
|
"type": jobType,
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// GetDetectionHistoryAPI returns detection history for a job type
|
|
func (h *PluginHandlers) GetDetectionHistoryAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]interface{}{
|
|
"job_type": jobType,
|
|
"records": []interface{}{},
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// GetExecutionHistoryAPI returns execution history for a job type
|
|
func (h *PluginHandlers) GetExecutionHistoryAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]interface{}{
|
|
"job_type": jobType,
|
|
"records": []interface{}{},
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// TriggerDetectionAPI manually triggers detection
|
|
func (h *PluginHandlers) TriggerDetectionAPI(c *gin.Context) {
|
|
jobType := c.Param("type")
|
|
result := map[string]interface{}{
|
|
"status": "triggered",
|
|
"job_type": jobType,
|
|
"job_ids": []string{},
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// CancelJobAPI cancels a job
|
|
func (h *PluginHandlers) CancelJobAPI(c *gin.Context) {
|
|
jobID := c.Param("id")
|
|
result := map[string]string{
|
|
"status": "cancelled",
|
|
"job_id": jobID,
|
|
}
|
|
c.JSON(http.StatusOK, result)
|
|
}
|