forked from JointCloud/pcm-coordinator
33 lines
849 B
Go
33 lines
849 B
Go
package cloud
|
|
|
|
import (
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
"io"
|
|
"k8s.io/apimachinery/pkg/util/json"
|
|
"net/http"
|
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
|
container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
|
|
)
|
|
|
|
func ContainerGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
var req container.GetParam
|
|
body, err := io.ReadAll(r.Body)
|
|
if err != nil {
|
|
result.ParamErrorResult(r, w, err)
|
|
return
|
|
}
|
|
|
|
if err = json.Unmarshal(body, &req); err != nil {
|
|
result.ParamErrorResult(r, w, err)
|
|
return
|
|
}
|
|
|
|
l := cloud.NewContainerGetLogic(r.Context(), svcCtx)
|
|
resp, err := l.ContainerGet(&req)
|
|
result.HttpResult(r, w, resp, err)
|
|
}
|
|
}
|