MCPcopy Index your code
hub / github.com/deepflowio/deepflow / listPlugin

Function listPlugin

cli/ctl/plugin.go:137–163  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

135}
136
137func listPlugin(cmd *cobra.Command) {
138 server := common.GetServerInfo(cmd)
139 url := fmt.Sprintf("http://%s:%d/v1/plugin/", server.IP, server.Port)
140 response, err := common.CURLPerform("GET", url, nil, "", []common.HTTPOption{common.WithTimeout(common.GetTimeout(cmd)), common.WithORGID(common.GetORGID(cmd))}...)
141 if err != nil {
142 fmt.Println(err)
143 return
144 }
145 data := response.Get("DATA")
146 var (
147 typeMaxSize = jsonparser.GetTheMaxSizeOfAttr(data, "TYPE")
148 nameMaxSize = jsonparser.GetTheMaxSizeOfAttr(data, "NAME")
149 userMaxSize = jsonparser.GetTheMaxSizeOfAttr(data, "USER")
150 )
151 cmdFormat := "%-*s %-*s %-*s %-19s\n"
152 fmt.Printf(cmdFormat, typeMaxSize, "TYPE", nameMaxSize, "NAME", userMaxSize, "USER", "UPDATED_AT")
153 for i := range data.MustArray() {
154 d := data.GetIndex(i)
155
156 fmt.Printf(cmdFormat,
157 typeMaxSize, common.PluginType(d.Get("TYPE").MustInt()),
158 nameMaxSize, d.Get("NAME").MustString(),
159 userMaxSize, common.PluginUser(d.Get("USER").MustInt()),
160 d.Get("UPDATED_AT").MustString(),
161 )
162 }
163}
164
165func deletePlugin(cmd *cobra.Command, args []string) error {
166 if len(args) == 0 {

Callers 1

RegisterPluginCommandFunction · 0.85

Calls 2

GetMethod · 0.65
GetORGIDMethod · 0.45

Tested by

no test coverage detected