This commit is contained in:
scheibling
2025-04-08 19:24:11 +02:00
commit 30fb57f4f7
92 changed files with 6196 additions and 0 deletions

46
system_status_tool.go Normal file
View 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
}