|
|
|
@@ -1,7 +1,6 @@ |
|
|
|
package inference |
|
|
|
|
|
|
|
import ( |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx" |
|
|
|
@@ -10,17 +9,20 @@ import ( |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" |
|
|
|
) |
|
|
|
|
|
|
|
func GetRunningInstanceByTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
|
|
|
func GetRunningInstanceByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { |
|
|
|
return func(w http.ResponseWriter, r *http.Request) { |
|
|
|
var req types.GetRunningInstanceReq |
|
|
|
if err := httpx.Parse(r, &req); err != nil { |
|
|
|
result.ParamErrorResult(r, w, err) |
|
|
|
httpx.ErrorCtx(r.Context(), w, err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
l := inference.NewGetRunningInstanceByTypeLogic(r.Context(), svcCtx) |
|
|
|
resp, err := l.GetRunningInstanceByType(&req) |
|
|
|
result.HttpResult(r, w, resp, err) |
|
|
|
|
|
|
|
l := inference.NewGetRunningInstanceByIdLogic(r.Context(), svcCtx) |
|
|
|
resp, err := l.GetRunningInstanceById(&req) |
|
|
|
if err != nil { |
|
|
|
httpx.ErrorCtx(r.Context(), w, err) |
|
|
|
} else { |
|
|
|
httpx.OkJsonCtx(r.Context(), w, resp) |
|
|
|
} |
|
|
|
} |
|
|
|
} |