Rainbond/api/handler/pod_action.go

27 lines
616 B
Go
Raw Normal View History

2019-08-21 15:07:20 +08:00
package handler
import (
2019-08-23 15:55:40 +08:00
"github.com/goodrain/rainbond/worker/server/pb"
2019-08-23 07:33:26 +08:00
"strings"
2019-08-21 15:07:20 +08:00
"github.com/goodrain/rainbond/worker/client"
2019-08-23 07:33:26 +08:00
"github.com/goodrain/rainbond/worker/server"
2019-08-21 15:07:20 +08:00
)
// PodAction is an implementation of PodHandler
type PodAction struct {
statusCli *client.AppRuntimeSyncClient
}
// PodDetail -
2019-08-23 15:55:40 +08:00
func (p *PodAction) PodDetail(serviceID, podName string) (*pb.PodDetail, error) {
2019-08-23 07:33:26 +08:00
pd, err := p.statusCli.GetPodDetail(serviceID, podName)
if err != nil {
if strings.Contains(err.Error(), server.ErrPodNotFound.Error()) {
return nil, server.ErrPodNotFound
}
return nil, err
}
2019-08-23 15:55:40 +08:00
return pd, nil
2019-08-21 15:07:20 +08:00
}