(_ *cobra.Command, _ []string)
| 50 | } |
| 51 | |
| 52 | func exec(_ *cobra.Command, _ []string) { |
| 53 | cfg := adminclient.NewConfiguration() |
| 54 | cfg.Servers = []adminclient.ServerConfiguration{{ |
| 55 | URL: common.Config.ServiceAddr, |
| 56 | }} |
| 57 | cli := adminclient.NewAPIClient(cfg) |
| 58 | |
| 59 | res, err := cli.TubeAPI.ProduceMessage(context.Background(), config.name).Body(config.content).Execute() |
| 60 | if err != nil { |
| 61 | fmt.Printf("Failed to produce event: %v\n", err) |
| 62 | os.Exit(1) |
| 63 | } |
| 64 | if res.StatusCode != 200 { |
| 65 | fmt.Printf("Failed to produce event: %v\n", res.Status) |
| 66 | os.Exit(1) |
| 67 | } |
| 68 | fmt.Println("Event produced") |
| 69 | } |
nothing calls this directly
no test coverage detected