(cmd *cobra.Command, args []string, createFilename string)
| 218 | } |
| 219 | |
| 220 | func 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 | |
| 246 | func updateAgentGroupConfig(cmd *cobra.Command, args []string, updateFilename string) { |
| 247 | if len(args) == 0 { |
no test coverage detected