()
| 27 | ) |
| 28 | |
| 29 | func RegisterAgentGroupConfigCommand() *cobra.Command { |
| 30 | agentGroupConfig := &cobra.Command{ |
| 31 | Use: "agent-group-config", |
| 32 | Short: "agent-group config operation commands", |
| 33 | Run: func(cmd *cobra.Command, args []string) { |
| 34 | fmt.Printf("please run with 'example | list | create | update | delete'.\n") |
| 35 | }, |
| 36 | } |
| 37 | |
| 38 | var listOutput string |
| 39 | list := &cobra.Command{ |
| 40 | Use: "list [agent-group ID]", |
| 41 | Short: "list config", |
| 42 | Example: "deepflow-ctl agent-group-config list g-xxxxxx", |
| 43 | Run: func(cmd *cobra.Command, args []string) { |
| 44 | listAgentGroupConfig(cmd, args, listOutput) |
| 45 | }, |
| 46 | } |
| 47 | list.Flags().StringVarP(&listOutput, "output", "o", "", "output format") |
| 48 | |
| 49 | var createFilename string |
| 50 | create := &cobra.Command{ |
| 51 | Use: "create <agent-group ID> -f <filename>", |
| 52 | Short: "create config", |
| 53 | Example: "deepflow-ctl agent-group-config create g-xxxxxx -f deepflow-config.yaml", |
| 54 | Run: func(cmd *cobra.Command, args []string) { |
| 55 | createAgentGroupConfig(cmd, args, createFilename) |
| 56 | }, |
| 57 | } |
| 58 | create.Flags().StringVarP(&createFilename, "filename", "f", "", "file to use create agent-group config") |
| 59 | create.MarkFlagRequired("filename") |
| 60 | |
| 61 | var updateFilename string |
| 62 | update := &cobra.Command{ |
| 63 | Use: "update <agent-group ID> -f <filename>", |
| 64 | Short: "update agent-group config", |
| 65 | Example: "deepflow-ctl agent-group-config update g-xxxxxx -f deepflow-config.yaml", |
| 66 | Run: func(cmd *cobra.Command, args []string) { |
| 67 | updateAgentGroupConfig(cmd, args, updateFilename) |
| 68 | }, |
| 69 | } |
| 70 | update.Flags().StringVarP(&updateFilename, "filename", "f", "", "file to use update agent-group config") |
| 71 | update.MarkFlagRequired("filename") |
| 72 | |
| 73 | delete := &cobra.Command{ |
| 74 | Use: "delete <agent-group ID>", |
| 75 | Short: "delete agent-group config", |
| 76 | Example: "deepflow-ctl agent-group-config delete g-xxxxxx", |
| 77 | Run: func(cmd *cobra.Command, args []string) { |
| 78 | deleteAgentGroupConfig(cmd, args) |
| 79 | }, |
| 80 | } |
| 81 | |
| 82 | example := &cobra.Command{ |
| 83 | Use: "example", |
| 84 | Short: "example agent-group config", |
| 85 | Run: func(cmd *cobra.Command, args []string) { |
| 86 | exampleAgentGroupConfig(cmd, args) |
no test coverage detected