57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"gitlink.org.cn/cloudream/common/sdks"
|
|
"gitlink.org.cn/cloudream/jcs-pub/client/internal/mount"
|
|
)
|
|
|
|
type MountService struct {
|
|
*Client
|
|
}
|
|
|
|
func (c *Client) Mount() *MountService {
|
|
return &MountService{
|
|
Client: c,
|
|
}
|
|
}
|
|
|
|
const MountDumpStatusPath = "/mount/dumpStatus"
|
|
|
|
type MountDumpStatus struct{}
|
|
|
|
func (r *MountDumpStatus) MakeParam() *sdks.RequestParam {
|
|
return sdks.MakeQueryParam(http.MethodGet, MountDumpStatusPath, r)
|
|
}
|
|
|
|
type MountDumpStatusResp struct {
|
|
mount.MountStatus
|
|
}
|
|
|
|
func (r *MountDumpStatusResp) ParseResponse(resp *http.Response) error {
|
|
return sdks.ParseCodeDataJSONResponse(resp, r)
|
|
}
|
|
|
|
func (c *MountService) DumpStatus(req MountDumpStatus) (*MountDumpStatusResp, error) {
|
|
return JSONAPI(&c.cfg, c.httpCli, &req, &MountDumpStatusResp{})
|
|
}
|
|
|
|
const MountStartReclaimSpacePath = "/mount/startReclaimSpace"
|
|
|
|
type StartMountReclaimSpace struct{}
|
|
|
|
func (r *StartMountReclaimSpace) MakeParam() *sdks.RequestParam {
|
|
return sdks.MakeJSONParam(http.MethodPost, MountStartReclaimSpacePath, r)
|
|
}
|
|
|
|
type StartMountReclaimSpaceResp struct{}
|
|
|
|
func (r *StartMountReclaimSpaceResp) ParseResponse(resp *http.Response) error {
|
|
return sdks.ParseCodeDataJSONResponse(resp, r)
|
|
}
|
|
|
|
func (c *MountService) StartReclaimSpace(req StartMountReclaimSpace) (*StartMountReclaimSpaceResp, error) {
|
|
return JSONAPI(&c.cfg, c.httpCli, &req, &StartMountReclaimSpaceResp{})
|
|
}
|