You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

status.go 927 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package admin
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "github.com/spf13/cobra"
  7. cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1"
  8. "gitlink.org.cn/cloudream/jcs-pub/jcsctl/cmd"
  9. )
  10. func init() {
  11. var opt statusOpt
  12. cmd := cobra.Command{
  13. Use: "status",
  14. Args: cobra.ExactArgs(0),
  15. RunE: func(c *cobra.Command, args []string) error {
  16. ctx := cmd.GetCmdCtx(c)
  17. return status(c, ctx, opt, args)
  18. },
  19. }
  20. AdminCmd.AddCommand(&cmd)
  21. }
  22. type statusOpt struct {
  23. }
  24. func status(c *cobra.Command, ctx *cmd.CommandContext, opt statusOpt, args []string) error {
  25. resp, err := ctx.Client.System().Status(cliapi.SystemStatus{})
  26. if err != nil {
  27. return fmt.Errorf("get system status: %v", err)
  28. }
  29. bw := bytes.NewBuffer(nil)
  30. enc := json.NewEncoder(bw)
  31. enc.SetIndent("", " ")
  32. err = enc.Encode(resp)
  33. if err != nil {
  34. return fmt.Errorf("encode system status: %v", err)
  35. }
  36. fmt.Println(bw.String())
  37. return nil
  38. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。