1 Star 0 Fork 0

ryancartoon/sensu-go

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
opt_in.go 799 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nikki Attea 提交于 2019-03-29 04:32 +08:00 . Feature/tessen sensuctl (#2820)
package tessen
import (
"errors"
"fmt"
corev2 "github.com/sensu/sensu-go/api/core/v2"
"github.com/sensu/sensu-go/cli"
"github.com/spf13/cobra"
)
// OptInCommand updates the tessen configuration to opt-in
func OptInCommand(cli *cli.SensuCli) *cobra.Command {
cmd := &cobra.Command{
Use: "opt-in",
Short: "opt-in to the tessen call home service",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
_ = cmd.Help()
return errors.New("invalid argument(s) received")
}
config := corev2.TessenConfig{OptOut: false}
if err := cli.Client.Put(config.URIPath(), config); err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "Thank you so much for opting in!")
return nil
},
}
return cmd
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

搜索帮助