MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / exec

Function exec

cmd/client/produce/cmd.go:52–69  ·  view source on GitHub ↗
(_ *cobra.Command, _ []string)

Source from the content-addressed store, hash-verified

50}
51
52func 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}

Callers

nothing calls this directly

Calls 3

ProduceMessageMethod · 0.80
ExecuteMethod · 0.45
BodyMethod · 0.45

Tested by

no test coverage detected