MCPcopy Create free account
hub / github.com/deepflowio/deepflow / createAgentGroupConfig

Function createAgentGroupConfig

cli/ctl/agent_group_config.go:220–244  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, createFilename string)

Source from the content-addressed store, hash-verified

218}
219
220func createAgentGroupConfig(cmd *cobra.Command, args []string, createFilename string) {
221 if len(args) == 0 {
222 fmt.Fprintln(os.Stderr, "must specify agent-group ID.\nExample: %s", cmd.Example)
223 return
224 }
225 server := common.GetServerInfo(cmd)
226
227 agentGroupLcuuid, err := getAgentGroupLcuuid(cmd, server, args[0])
228 if err != nil {
229 fmt.Fprintln(os.Stderr, err)
230 return
231 }
232 url := fmt.Sprintf("http://%s:%d/v1/agent-group-configuration/%s/yaml", server.IP, server.Port, agentGroupLcuuid)
233
234 yamlFile, err := os.ReadFile(createFilename)
235 if err != nil {
236 fmt.Fprintln(os.Stderr, err)
237 }
238 _, err = common.CURLPerform("POST", url, nil, string(yamlFile),
239 []common.HTTPOption{common.WithTimeout(common.GetTimeout(cmd)), common.WithORGID(common.GetORGID(cmd))}...)
240 if err != nil {
241 fmt.Fprintln(os.Stderr, err)
242 return
243 }
244}
245
246func updateAgentGroupConfig(cmd *cobra.Command, args []string, updateFilename string) {
247 if len(args) == 0 {

Callers 1

Calls 2

getAgentGroupLcuuidFunction · 0.85
GetORGIDMethod · 0.45

Tested by

no test coverage detected