diff --git a/pkg/api/rest/controller/health.go b/pkg/api/rest/controller/health.go index 65605db..367cfae 100644 --- a/pkg/api/rest/controller/health.go +++ b/pkg/api/rest/controller/health.go @@ -11,15 +11,16 @@ var OkMessage = model.SimpleMsg{} var IsReady = false // CheckReady func is for checking Cicada server health. -// @Summary Check Ready -// @Description Check Cicada is ready -// @Tags [Admin] System management -// @Accept json -// @Produce json -// @Success 200 {object} model.SimpleMsg "Successfully get ready state." -// @Failure 500 {object} common.ErrorResponse "Failed to check ready state." // -// @Router /readyz [get] +// @ID health-check-readyz +// @Summary Check Ready +// @Description Check Cicada is ready +// @Tags [Admin] System management +// @Accept json +// @Produce json +// @Success 200 {object} model.SimpleMsg "Successfully get ready state." +// @Failure 500 {object} common.ErrorResponse "Failed to check ready state." +// @Router /readyz [get] func CheckReady(c echo.Context) error { status := http.StatusOK diff --git a/pkg/api/rest/controller/taskComponent.go b/pkg/api/rest/controller/taskComponent.go index ad4ecc4..5c7f516 100644 --- a/pkg/api/rest/controller/taskComponent.go +++ b/pkg/api/rest/controller/taskComponent.go @@ -12,16 +12,17 @@ import ( // CreateTaskComponent godoc // -// @Summary Create TaskComponent -// @Description Register the task component. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param TaskComponent body model.CreateTaskComponentReq true "task component of the node." -// @Success 200 {object} model.TaskComponent "Successfully register the task component" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to register the task component" -// @Router /task_component [post] +// @ID create-task-component +// @Summary Create TaskComponent +// @Description Register the task component. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param TaskComponent body model.CreateTaskComponentReq true "task component of the node." +// @Success 200 {object} model.TaskComponent "Successfully register the task component" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to register the task component" +// @Router /task_component [post] func CreateTaskComponent(c echo.Context) error { createTaskComponentReq := new(model.CreateTaskComponentReq) err := c.Bind(createTaskComponentReq) @@ -48,16 +49,17 @@ func CreateTaskComponent(c echo.Context) error { // GetTaskComponent godoc // -// @Summary Get TaskComponent -// @Description Get the task component. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param tcId path string true "ID of the TaskComponent" -// @Success 200 {object} model.TaskComponent "Successfully get the task component" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task component" -// @Router /task_component/{tcId} [get] +// @ID get-task-component +// @Summary Get TaskComponent +// @Description Get the task component. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param tcId path string true "ID of the TaskComponent" +// @Success 200 {object} model.TaskComponent "Successfully get the task component" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task component" +// @Router /task_component/{tcId} [get] func GetTaskComponent(c echo.Context) error { tcId := c.Param("tcId") if tcId == "" { @@ -72,16 +74,17 @@ func GetTaskComponent(c echo.Context) error { // GetTaskComponentByName godoc // -// @Summary Get TaskComponent by Name -// @Description Get the task component by name. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param tcName path string true "Name of the TaskComponent" -// @Success 200 {object} model.TaskComponent "Successfully get the task component" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task component" -// @Router /task_component/name/{tcName} [get] +// @ID get-task-component-by-name +// @Summary Get TaskComponent by Name +// @Description Get the task component by name. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param tcName path string true "Name of the TaskComponent" +// @Success 200 {object} model.TaskComponent "Successfully get the task component" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task component" +// @Router /task_component/name/{tcName} [get] func GetTaskComponentByName(c echo.Context) error { tcName := c.Param("tcName") if tcName == "" { @@ -96,17 +99,18 @@ func GetTaskComponentByName(c echo.Context) error { // ListTaskComponent godoc // -// @Summary List TaskComponent -// @Description Get a list of task component. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param page query string false "Page of the task component list." -// @Param row query string false "Row of the task component list." -// @Success 200 {object} []model.TaskComponent "Successfully get a list of task component." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a list of task component." -// @Router /task_component [get] +// @ID list-task-component +// @Summary List TaskComponent +// @Description Get a list of task component. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param page query string false "Page of the task component list." +// @Param row query string false "Row of the task component list." +// @Success 200 {object} []model.TaskComponent "Successfully get a list of task component." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a list of task component." +// @Router /task_component [get] func ListTaskComponent(c echo.Context) error { page, row, err := common.CheckPageRow(c) if err != nil { @@ -122,17 +126,18 @@ func ListTaskComponent(c echo.Context) error { // UpdateTaskComponent godoc // -// @Summary Update TaskComponent -// @Description Update the task component. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param tcId path string true "ID of the TaskComponent" -// @Param TaskComponent body model.CreateTaskComponentReq true "task component to modify." -// @Success 200 {object} model.TaskComponent "Successfully update the task component" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to update the task component" -// @Router /task_component/{tcId} [put] +// @ID update-task-component +// @Summary Update TaskComponent +// @Description Update the task component. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param tcId path string true "ID of the TaskComponent" +// @Param TaskComponent body model.CreateTaskComponentReq true "task component to modify." +// @Success 200 {object} model.TaskComponent "Successfully update the task component" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to update the task component" +// @Router /task_component/{tcId} [put] func UpdateTaskComponent(c echo.Context) error { taskComponent := new(model.CreateTaskComponentReq) err := c.Bind(taskComponent) @@ -165,16 +170,17 @@ func UpdateTaskComponent(c echo.Context) error { // DeleteTaskComponent godoc // -// @Summary Delete TaskComponent -// @Description Delete the task component. -// @Tags [Task Component] -// @Accept json -// @Produce json -// @Param tcId path string true "ID of the task component." -// @Success 200 {object} model.SimpleMsg "Successfully delete the task component" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to delete the task component" -// @Router /task_component/{tcId} [delete] +// @ID delete-task-component +// @Summary Delete TaskComponent +// @Description Delete the task component. +// @Tags [Task Component] +// @Accept json +// @Produce json +// @Param tcId path string true "ID of the task component." +// @Success 200 {object} model.SimpleMsg "Successfully delete the task component" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to delete the task component" +// @Router /task_component/{tcId} [delete] func DeleteTaskComponent(c echo.Context) error { tcId := c.Param("tcId") if tcId == "" { diff --git a/pkg/api/rest/controller/workflow.go b/pkg/api/rest/controller/workflow.go index 2b00dc4..b91bb6d 100644 --- a/pkg/api/rest/controller/workflow.go +++ b/pkg/api/rest/controller/workflow.go @@ -96,16 +96,17 @@ func createDataReqToData(createDataReq model.CreateDataReq) (model.Data, error) // CreateWorkflow godoc // -// @Summary Create Workflow -// @Description Create a workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param request body model.CreateWorkflowReq true "Workflow content" -// @Success 200 {object} model.WorkflowTemplate "Successfully create the workflow." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to create workflow." -// @Router /workflow [post] +// @ID create-workflow +// @Summary Create Workflow +// @Description Create a workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param request body model.CreateWorkflowReq true "Workflow content" +// @Success 200 {object} model.WorkflowTemplate "Successfully create the workflow." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to create workflow." +// @Router /workflow [post] func CreateWorkflow(c echo.Context) error { var createWorkflowReq model.CreateWorkflowReq @@ -183,16 +184,17 @@ func CreateWorkflow(c echo.Context) error { // GetWorkflow godoc // -// @Summary Get Workflow -// @Description Get the workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Success 200 {object} model.Workflow "Successfully get the workflow." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow." -// @Router /workflow/{wfId} [get] +// @ID get-workflow +// @Summary Get Workflow +// @Description Get the workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Success 200 {object} model.Workflow "Successfully get the workflow." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow." +// @Router /workflow/{wfId} [get] func GetWorkflow(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -232,16 +234,17 @@ func GetWorkflow(c echo.Context) error { // GetWorkflowByName godoc // -// @Summary Get Workflow by Name -// @Description Get the workflow by name. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfName path string true "Name of the workflow." -// @Success 200 {object} model.Workflow "Successfully get the workflow." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow." -// @Router /workflow/name/{wfName} [get] +// @ID get-workflow-by-name +// @Summary Get Workflow by Name +// @Description Get the workflow by name. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfName path string true "Name of the workflow." +// @Success 200 {object} model.Workflow "Successfully get the workflow." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow." +// @Router /workflow/name/{wfName} [get] func GetWorkflowByName(c echo.Context) error { wfName := c.Param("wfName") if wfName == "" { @@ -281,18 +284,19 @@ func GetWorkflowByName(c echo.Context) error { // ListWorkflow godoc // -// @Summary List Workflow -// @Description Get a workflow list. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param name query string false "Name of the workflow" -// @Param page query string false "Page of the workflow list." -// @Param row query string false "Row of the workflow list." -// @Success 200 {object} []model.Workflow "Successfully get a workflow list." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a workflow list." -// @Router /workflow [get] +// @ID list-workflow +// @Summary List Workflow +// @Description Get a workflow list. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param name query string false "Name of the workflow" +// @Param page query string false "Page of the workflow list." +// @Param row query string false "Row of the workflow list." +// @Success 200 {object} []model.Workflow "Successfully get a workflow list." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a workflow list." +// @Router /workflow [get] func ListWorkflow(c echo.Context) error { page, row, err := common.CheckPageRow(c) if err != nil { @@ -333,16 +337,17 @@ func ListWorkflow(c echo.Context) error { // RunWorkflow godoc // -// @Summary Run Workflow -// @Description Run the workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Success 200 {object} model.SimpleMsg "Successfully run the workflow." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to run the Workflow" -// @Router /workflow/{wfId}/run [post] +// @ID run-workflow +// @Summary Run Workflow +// @Description Run the workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Success 200 {object} model.SimpleMsg "Successfully run the workflow." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to run the Workflow" +// @Router /workflow/{wfId}/run [post] func RunWorkflow(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -364,17 +369,18 @@ func RunWorkflow(c echo.Context) error { // UpdateWorkflow godoc // -// @Summary Update Workflow -// @Description Update the workflow content. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Param Workflow body model.CreateWorkflowReq true "Workflow to modify." -// @Success 200 {object} model.Workflow "Successfully update the workflow" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to update the workflow" -// @Router /workflow/{wfId} [put] +// @ID update-workflow +// @Summary Update Workflow +// @Description Update the workflow content. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Param Workflow body model.CreateWorkflowReq true "Workflow to modify." +// @Success 200 {object} model.Workflow "Successfully update the workflow" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to update the workflow" +// @Router /workflow/{wfId} [put] func UpdateWorkflow(c echo.Context) error { var updateWorkflowReq model.CreateWorkflowReq @@ -482,16 +488,17 @@ func UpdateWorkflow(c echo.Context) error { // DeleteWorkflow godoc // -// @Summary Delete Workflow -// @Description Delete the workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Success 200 {object} model.SimpleMsg "Successfully delete the workflow" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to delete the workflow" -// @Router /workflow/{wfId} [delete] +// @ID delete-workflow +// @Summary Delete Workflow +// @Description Delete the workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Success 200 {object} model.SimpleMsg "Successfully delete the workflow" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to delete the workflow" +// @Router /workflow/{wfId} [delete] func DeleteWorkflow(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -540,16 +547,17 @@ func DeleteWorkflow(c echo.Context) error { // ListTaskGroup godoc // -// @Summary List TaskGroup -// @Description Get a task group list of the workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Success 200 {object} []model.TaskGroup "Successfully get a task group list." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a task group list." -// @Router /workflow/{wfId}/task_group [get] +// @ID list-task-group +// @Summary List TaskGroup +// @Description Get a task group list of the workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Success 200 {object} []model.TaskGroup "Successfully get a task group list." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a task group list." +// @Router /workflow/{wfId}/task_group [get] func ListTaskGroup(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -569,17 +577,18 @@ func ListTaskGroup(c echo.Context) error { // GetTaskGroup godoc // -// @Summary Get TaskGroup -// @Description Get the task group. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Param tgId path string true "ID of the task group." -// @Success 200 {object} model.Task "Successfully get the task group." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task group." -// @Router /workflow/{wfId}/task_group/{tgId} [get] +// @ID get-task-group +// @Summary Get TaskGroup +// @Description Get the task group. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Param tgId path string true "ID of the task group." +// @Success 200 {object} model.Task "Successfully get the task group." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task group." +// @Router /workflow/{wfId}/task_group/{tgId} [get] func GetTaskGroup(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -607,16 +616,17 @@ func GetTaskGroup(c echo.Context) error { // GetTaskGroupDirectly godoc // -// @Summary Get TaskGroup Directly -// @Description Get the task group directly. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param tgId path string true "ID of the task group." -// @Success 200 {object} model.Task "Successfully get the task group." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task group." -// @Router /task_group/{tgId} [get] +// @ID get-task-group-directly +// @Summary Get TaskGroup Directly +// @Description Get the task group directly. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param tgId path string true "ID of the task group." +// @Success 200 {object} model.Task "Successfully get the task group." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task group." +// @Router /task_group/{tgId} [get] func GetTaskGroupDirectly(c echo.Context) error { tgId := c.Param("tgId") if tgId == "" { @@ -650,17 +660,18 @@ func GetTaskGroupDirectly(c echo.Context) error { // ListTaskFromTaskGroup godoc // -// @Summary List Task from Task Group -// @Description Get a task list from the task group. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Param tgId path string true "ID of the task group." -// @Success 200 {object} []model.Task "Successfully get a task list from the task group." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a task list from the task group." -// @Router /workflow/{wfId}/task_group/{tgId}/task [get] +// @ID list-task-from-task-group +// @Summary List Task from Task Group +// @Description Get a task list from the task group. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Param tgId path string true "ID of the task group." +// @Success 200 {object} []model.Task "Successfully get a task list from the task group." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a task list from the task group." +// @Router /workflow/{wfId}/task_group/{tgId}/task [get] func ListTaskFromTaskGroup(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -690,18 +701,19 @@ func ListTaskFromTaskGroup(c echo.Context) error { // GetTaskFromTaskGroup godoc // -// @Summary Get Task from Task Group -// @Description Get the task from the task group. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Param tgId path string true "ID of the task group." -// @Param taskId path string true "ID of the task." -// @Success 200 {object} model.Task "Successfully get the task from the task group." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task from the task group." -// @Router /workflow/{wfId}/task_group/{tgId}/task/{taskId} [get] +// @ID get-task-from-task-group +// @Summary Get Task from Task Group +// @Description Get the task from the task group. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Param tgId path string true "ID of the task group." +// @Param taskId path string true "ID of the task." +// @Success 200 {object} model.Task "Successfully get the task from the task group." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task from the task group." +// @Router /workflow/{wfId}/task_group/{tgId}/task/{taskId} [get] func GetTaskFromTaskGroup(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -740,16 +752,17 @@ func GetTaskFromTaskGroup(c echo.Context) error { // ListTask godoc // -// @Summary List Task -// @Description Get a task list of the workflow. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Success 200 {object} []model.Task "Successfully get a task list." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a task list." -// @Router /workflow/{wfId}/task [get] +// @ID list-task +// @Summary List Task +// @Description Get a task list of the workflow. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Success 200 {object} []model.Task "Successfully get a task list." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a task list." +// @Router /workflow/{wfId}/task [get] func ListTask(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -771,17 +784,18 @@ func ListTask(c echo.Context) error { // GetTask godoc // -// @Summary Get Task -// @Description Get the task. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param wfId path string true "ID of the workflow." -// @Param taskId path string true "ID of the task." -// @Success 200 {object} model.Task "Successfully get the task." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task." -// @Router /workflow/{wfId}/task/{taskId} [get] +// @ID get-task +// @Summary Get Task +// @Description Get the task. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param wfId path string true "ID of the workflow." +// @Param taskId path string true "ID of the task." +// @Success 200 {object} model.Task "Successfully get the task." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task." +// @Router /workflow/{wfId}/task/{taskId} [get] func GetTask(c echo.Context) error { wfId := c.Param("wfId") if wfId == "" { @@ -811,16 +825,17 @@ func GetTask(c echo.Context) error { // GetTaskDirectly godoc // -// @Summary Get Task Directly -// @Description Get the task directly. -// @Tags [Workflow] -// @Accept json -// @Produce json -// @Param taskId path string true "ID of the task." -// @Success 200 {object} model.TaskDirectly "Successfully get the task." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the task." -// @Router /task/{taskId} [get] +// @ID get-task-directly +// @Summary Get Task Directly +// @Description Get the task directly. +// @Tags [Workflow] +// @Accept json +// @Produce json +// @Param taskId path string true "ID of the task." +// @Success 200 {object} model.TaskDirectly "Successfully get the task." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the task." +// @Router /task/{taskId} [get] func GetTaskDirectly(c echo.Context) error { taskId := c.Param("taskId") if taskId == "" { diff --git a/pkg/api/rest/controller/workflowTemplate.go b/pkg/api/rest/controller/workflowTemplate.go index 423cdd1..8b76fbb 100644 --- a/pkg/api/rest/controller/workflowTemplate.go +++ b/pkg/api/rest/controller/workflowTemplate.go @@ -12,16 +12,17 @@ import ( // GetWorkflowTemplate godoc // -// @Summary Get WorkflowTemplate -// @Description Get the workflow template. -// @Tags [Workflow Template] -// @Accept json -// @Produce json -// @Param wftId path string true "ID of the WorkflowTemplate" -// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template" -// @Router /workflow_template/{wftId} [get] +// @ID get-workflow-template +// @Summary Get WorkflowTemplate +// @Description Get the workflow template. +// @Tags [Workflow Template] +// @Accept json +// @Produce json +// @Param wftId path string true "ID of the WorkflowTemplate" +// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template" +// @Router /workflow_template/{wftId} [get] func GetWorkflowTemplate(c echo.Context) error { wftId := c.Param("wftId") if wftId == "" { @@ -36,16 +37,17 @@ func GetWorkflowTemplate(c echo.Context) error { // GetWorkflowTemplateByName godoc // -// @Summary Get WorkflowTemplate by Name -// @Description Get the workflow template by name. -// @Tags [Workflow Template] -// @Accept json -// @Produce json -// @Param wfName path string true "Name of the WorkflowTemplate" -// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template" -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template" -// @Router /workflow_template/name/{wfName} [get] +// @ID get-workflow-template-by-name +// @Summary Get WorkflowTemplate by Name +// @Description Get the workflow template by name. +// @Tags [Workflow Template] +// @Accept json +// @Produce json +// @Param wfName path string true "Name of the WorkflowTemplate" +// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template" +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template" +// @Router /workflow_template/name/{wfName} [get] func GetWorkflowTemplateByName(c echo.Context) error { wfName := c.Param("wfName") if wfName == "" { @@ -63,18 +65,19 @@ func GetWorkflowTemplateByName(c echo.Context) error { // ListWorkflowTemplate godoc // -// @Summary List WorkflowTemplate -// @Description Get a list of workflow template. -// @Tags [Workflow Template] -// @Accept json -// @Produce json -// @Param name query string false "Name of the workflow template" -// @Param page query string false "Page of the workflow template list." -// @Param row query string false "Row of the workflow template list." -// @Success 200 {object} []model.WorkflowTemplate "Successfully get a list of workflow template." -// @Failure 400 {object} common.ErrorResponse "Sent bad request." -// @Failure 500 {object} common.ErrorResponse "Failed to get a list of workflow template." -// @Router /workflow_template [get] +// @ID list-workflow-template +// @Summary List WorkflowTemplate +// @Description Get a list of workflow template. +// @Tags [Workflow Template] +// @Accept json +// @Produce json +// @Param name query string false "Name of the workflow template" +// @Param page query string false "Page of the workflow template list." +// @Param row query string false "Row of the workflow template list." +// @Success 200 {object} []model.WorkflowTemplate "Successfully get a list of workflow template." +// @Failure 400 {object} common.ErrorResponse "Sent bad request." +// @Failure 500 {object} common.ErrorResponse "Failed to get a list of workflow template." +// @Router /workflow_template [get] func ListWorkflowTemplate(c echo.Context) error { page, row, err := common.CheckPageRow(c) if err != nil { diff --git a/pkg/api/rest/docs/docs.go b/pkg/api/rest/docs/docs.go index fa2c95e..1559e10 100644 --- a/pkg/api/rest/docs/docs.go +++ b/pkg/api/rest/docs/docs.go @@ -29,9 +29,10 @@ const docTemplate = `{ "application/json" ], "tags": [ - "[Admin] System management" + "[Admin]\tSystem management" ], "summary": "Check Ready", + "operationId": "health-check-readyz", "responses": { "200": { "description": "Successfully get ready state.", @@ -61,6 +62,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get Task Directly", + "operationId": "get-task-directly", "parameters": [ { "type": "string", @@ -105,6 +107,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "List TaskComponent", + "operationId": "list-task-component", "parameters": [ { "type": "string", @@ -155,6 +158,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "Create TaskComponent", + "operationId": "create-task-component", "parameters": [ { "description": "task component of the node.", @@ -201,6 +205,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "Get TaskComponent by Name", + "operationId": "get-task-component-by-name", "parameters": [ { "type": "string", @@ -245,6 +250,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "Get TaskComponent", + "operationId": "get-task-component", "parameters": [ { "type": "string", @@ -287,6 +293,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "Update TaskComponent", + "operationId": "update-task-component", "parameters": [ { "type": "string", @@ -338,6 +345,7 @@ const docTemplate = `{ "[Task Component]" ], "summary": "Delete TaskComponent", + "operationId": "delete-task-component", "parameters": [ { "type": "string", @@ -382,6 +390,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get TaskGroup Directly", + "operationId": "get-task-group-directly", "parameters": [ { "type": "string", @@ -426,6 +435,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "List Workflow", + "operationId": "list-workflow", "parameters": [ { "type": "string", @@ -482,6 +492,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Create Workflow", + "operationId": "create-workflow", "parameters": [ { "description": "Workflow content", @@ -528,6 +539,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get Workflow by Name", + "operationId": "get-workflow-by-name", "parameters": [ { "type": "string", @@ -572,6 +584,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get Workflow", + "operationId": "get-workflow", "parameters": [ { "type": "string", @@ -614,6 +627,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Update Workflow", + "operationId": "update-workflow", "parameters": [ { "type": "string", @@ -665,6 +679,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Delete Workflow", + "operationId": "delete-workflow", "parameters": [ { "type": "string", @@ -709,6 +724,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Run Workflow", + "operationId": "run-workflow", "parameters": [ { "type": "string", @@ -753,6 +769,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "List Task", + "operationId": "list-task", "parameters": [ { "type": "string", @@ -800,6 +817,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get Task", + "operationId": "get-task", "parameters": [ { "type": "string", @@ -851,6 +869,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "List TaskGroup", + "operationId": "list-task-group", "parameters": [ { "type": "string", @@ -898,6 +917,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get TaskGroup", + "operationId": "get-task-group", "parameters": [ { "type": "string", @@ -949,6 +969,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "List Task from Task Group", + "operationId": "list-task-from-task-group", "parameters": [ { "type": "string", @@ -1003,6 +1024,7 @@ const docTemplate = `{ "[Workflow]" ], "summary": "Get Task from Task Group", + "operationId": "get-task-from-task-group", "parameters": [ { "type": "string", @@ -1061,6 +1083,7 @@ const docTemplate = `{ "[Workflow Template]" ], "summary": "List WorkflowTemplate", + "operationId": "list-workflow-template", "parameters": [ { "type": "string", @@ -1119,6 +1142,7 @@ const docTemplate = `{ "[Workflow Template]" ], "summary": "Get WorkflowTemplate by Name", + "operationId": "get-workflow-template-by-name", "parameters": [ { "type": "string", @@ -1163,6 +1187,7 @@ const docTemplate = `{ "[Workflow Template]" ], "summary": "Get WorkflowTemplate", + "operationId": "get-workflow-template", "parameters": [ { "type": "string", diff --git a/pkg/api/rest/docs/swagger.json b/pkg/api/rest/docs/swagger.json index e755dcf..25543f8 100644 --- a/pkg/api/rest/docs/swagger.json +++ b/pkg/api/rest/docs/swagger.json @@ -22,9 +22,10 @@ "application/json" ], "tags": [ - "[Admin] System management" + "[Admin]\tSystem management" ], "summary": "Check Ready", + "operationId": "health-check-readyz", "responses": { "200": { "description": "Successfully get ready state.", @@ -54,6 +55,7 @@ "[Workflow]" ], "summary": "Get Task Directly", + "operationId": "get-task-directly", "parameters": [ { "type": "string", @@ -98,6 +100,7 @@ "[Task Component]" ], "summary": "List TaskComponent", + "operationId": "list-task-component", "parameters": [ { "type": "string", @@ -148,6 +151,7 @@ "[Task Component]" ], "summary": "Create TaskComponent", + "operationId": "create-task-component", "parameters": [ { "description": "task component of the node.", @@ -194,6 +198,7 @@ "[Task Component]" ], "summary": "Get TaskComponent by Name", + "operationId": "get-task-component-by-name", "parameters": [ { "type": "string", @@ -238,6 +243,7 @@ "[Task Component]" ], "summary": "Get TaskComponent", + "operationId": "get-task-component", "parameters": [ { "type": "string", @@ -280,6 +286,7 @@ "[Task Component]" ], "summary": "Update TaskComponent", + "operationId": "update-task-component", "parameters": [ { "type": "string", @@ -331,6 +338,7 @@ "[Task Component]" ], "summary": "Delete TaskComponent", + "operationId": "delete-task-component", "parameters": [ { "type": "string", @@ -375,6 +383,7 @@ "[Workflow]" ], "summary": "Get TaskGroup Directly", + "operationId": "get-task-group-directly", "parameters": [ { "type": "string", @@ -419,6 +428,7 @@ "[Workflow]" ], "summary": "List Workflow", + "operationId": "list-workflow", "parameters": [ { "type": "string", @@ -475,6 +485,7 @@ "[Workflow]" ], "summary": "Create Workflow", + "operationId": "create-workflow", "parameters": [ { "description": "Workflow content", @@ -521,6 +532,7 @@ "[Workflow]" ], "summary": "Get Workflow by Name", + "operationId": "get-workflow-by-name", "parameters": [ { "type": "string", @@ -565,6 +577,7 @@ "[Workflow]" ], "summary": "Get Workflow", + "operationId": "get-workflow", "parameters": [ { "type": "string", @@ -607,6 +620,7 @@ "[Workflow]" ], "summary": "Update Workflow", + "operationId": "update-workflow", "parameters": [ { "type": "string", @@ -658,6 +672,7 @@ "[Workflow]" ], "summary": "Delete Workflow", + "operationId": "delete-workflow", "parameters": [ { "type": "string", @@ -702,6 +717,7 @@ "[Workflow]" ], "summary": "Run Workflow", + "operationId": "run-workflow", "parameters": [ { "type": "string", @@ -746,6 +762,7 @@ "[Workflow]" ], "summary": "List Task", + "operationId": "list-task", "parameters": [ { "type": "string", @@ -793,6 +810,7 @@ "[Workflow]" ], "summary": "Get Task", + "operationId": "get-task", "parameters": [ { "type": "string", @@ -844,6 +862,7 @@ "[Workflow]" ], "summary": "List TaskGroup", + "operationId": "list-task-group", "parameters": [ { "type": "string", @@ -891,6 +910,7 @@ "[Workflow]" ], "summary": "Get TaskGroup", + "operationId": "get-task-group", "parameters": [ { "type": "string", @@ -942,6 +962,7 @@ "[Workflow]" ], "summary": "List Task from Task Group", + "operationId": "list-task-from-task-group", "parameters": [ { "type": "string", @@ -996,6 +1017,7 @@ "[Workflow]" ], "summary": "Get Task from Task Group", + "operationId": "get-task-from-task-group", "parameters": [ { "type": "string", @@ -1054,6 +1076,7 @@ "[Workflow Template]" ], "summary": "List WorkflowTemplate", + "operationId": "list-workflow-template", "parameters": [ { "type": "string", @@ -1112,6 +1135,7 @@ "[Workflow Template]" ], "summary": "Get WorkflowTemplate by Name", + "operationId": "get-workflow-template-by-name", "parameters": [ { "type": "string", @@ -1156,6 +1180,7 @@ "[Workflow Template]" ], "summary": "Get WorkflowTemplate", + "operationId": "get-workflow-template", "parameters": [ { "type": "string", diff --git a/pkg/api/rest/docs/swagger.yaml b/pkg/api/rest/docs/swagger.yaml index 20af72d..b920447 100644 --- a/pkg/api/rest/docs/swagger.yaml +++ b/pkg/api/rest/docs/swagger.yaml @@ -275,6 +275,7 @@ paths: consumes: - application/json description: Check Cicada is ready + operationId: health-check-readyz produces: - application/json responses: @@ -288,12 +289,13 @@ paths: $ref: '#/definitions/github_com_cloud-barista_cm-cicada_pkg_api_rest_common.ErrorResponse' summary: Check Ready tags: - - '[Admin] System management' + - "[Admin]\tSystem management" /task/{taskId}: get: consumes: - application/json description: Get the task directly. + operationId: get-task-directly parameters: - description: ID of the task. in: path @@ -323,6 +325,7 @@ paths: consumes: - application/json description: Get a list of task component. + operationId: list-task-component parameters: - description: Page of the task component list. in: query @@ -356,6 +359,7 @@ paths: consumes: - application/json description: Register the task component. + operationId: create-task-component parameters: - description: task component of the node. in: body @@ -386,6 +390,7 @@ paths: consumes: - application/json description: Delete the task component. + operationId: delete-task-component parameters: - description: ID of the task component. in: path @@ -414,6 +419,7 @@ paths: consumes: - application/json description: Get the task component. + operationId: get-task-component parameters: - description: ID of the TaskComponent in: path @@ -442,6 +448,7 @@ paths: consumes: - application/json description: Update the task component. + operationId: update-task-component parameters: - description: ID of the TaskComponent in: path @@ -477,6 +484,7 @@ paths: consumes: - application/json description: Get the task component by name. + operationId: get-task-component-by-name parameters: - description: Name of the TaskComponent in: path @@ -506,6 +514,7 @@ paths: consumes: - application/json description: Get the task group directly. + operationId: get-task-group-directly parameters: - description: ID of the task group. in: path @@ -535,6 +544,7 @@ paths: consumes: - application/json description: Get a workflow list. + operationId: list-workflow parameters: - description: Name of the workflow in: query @@ -572,6 +582,7 @@ paths: consumes: - application/json description: Create a workflow. + operationId: create-workflow parameters: - description: Workflow content in: body @@ -602,6 +613,7 @@ paths: consumes: - application/json description: Delete the workflow. + operationId: delete-workflow parameters: - description: ID of the workflow. in: path @@ -630,6 +642,7 @@ paths: consumes: - application/json description: Get the workflow. + operationId: get-workflow parameters: - description: ID of the workflow. in: path @@ -658,6 +671,7 @@ paths: consumes: - application/json description: Update the workflow content. + operationId: update-workflow parameters: - description: ID of the workflow. in: path @@ -693,6 +707,7 @@ paths: consumes: - application/json description: Run the workflow. + operationId: run-workflow parameters: - description: ID of the workflow. in: path @@ -722,6 +737,7 @@ paths: consumes: - application/json description: Get a task list of the workflow. + operationId: list-task parameters: - description: ID of the workflow. in: path @@ -753,6 +769,7 @@ paths: consumes: - application/json description: Get the task. + operationId: get-task parameters: - description: ID of the workflow. in: path @@ -787,6 +804,7 @@ paths: consumes: - application/json description: Get a task group list of the workflow. + operationId: list-task-group parameters: - description: ID of the workflow. in: path @@ -818,6 +836,7 @@ paths: consumes: - application/json description: Get the task group. + operationId: get-task-group parameters: - description: ID of the workflow. in: path @@ -852,6 +871,7 @@ paths: consumes: - application/json description: Get a task list from the task group. + operationId: list-task-from-task-group parameters: - description: ID of the workflow. in: path @@ -888,6 +908,7 @@ paths: consumes: - application/json description: Get the task from the task group. + operationId: get-task-from-task-group parameters: - description: ID of the workflow. in: path @@ -927,6 +948,7 @@ paths: consumes: - application/json description: Get the workflow by name. + operationId: get-workflow-by-name parameters: - description: Name of the workflow. in: path @@ -956,6 +978,7 @@ paths: consumes: - application/json description: Get a list of workflow template. + operationId: list-workflow-template parameters: - description: Name of the workflow template in: query @@ -994,6 +1017,7 @@ paths: consumes: - application/json description: Get the workflow template. + operationId: get-workflow-template parameters: - description: ID of the WorkflowTemplate in: path @@ -1023,6 +1047,7 @@ paths: consumes: - application/json description: Get the workflow template by name. + operationId: get-workflow-template-by-name parameters: - description: Name of the WorkflowTemplate in: path