Created
This commit is contained in:
46
system_status_tool.go
Normal file
46
system_status_tool.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package woogo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.cloudyne.io/go/woogo/entity"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
type systemStatusToolService service
|
||||
|
||||
func (s systemStatusToolService) All() (item entity.SystemStatusTool, err error) {
|
||||
resp, err := s.httpClient.R().Get("/system_status/tools")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if resp.IsSuccess() {
|
||||
err = jsoniter.Unmarshal(resp.Body(), &item)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s systemStatusToolService) One(id string) (item entity.SystemStatusTool, err error) {
|
||||
resp, err := s.httpClient.R().Get(fmt.Sprintf("/system_status/tools/%s", id))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if resp.IsSuccess() {
|
||||
err = jsoniter.Unmarshal(resp.Body(), &item)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s systemStatusToolService) Run(id string) (item entity.SystemStatusTool, err error) {
|
||||
resp, err := s.httpClient.R().Put(fmt.Sprintf("/system_status/tools/%s", id))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if resp.IsSuccess() {
|
||||
err = jsoniter.Unmarshal(resp.Body(), &item)
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user