chore: 并入 iotlcm-upstream-proxy 历史到 upstream-proxy/(原提交 44209ec)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package channel
|
||||
|
||||
import "git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/api/channel"
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() channel.IChannelV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/api/channel/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Refresh(ctx context.Context, req *v1.RefreshReq) (res *v1.RefreshRes, err error) {
|
||||
if err = service.UpstreamAPI().RefreshChannel(ctx, req.ChanKey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RefreshRes{
|
||||
ChanKey: req.ChanKey,
|
||||
Refreshed: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) Remove(ctx context.Context, req *v1.RemoveReq) (res *v1.RemoveRes, err error) {
|
||||
if err = service.UpstreamAPI().RemoveChannel(ctx, req.ChanKey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.RemoveRes{ChanKey: req.ChanKey, Removed: true}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user