MCPcopy Create free account
hub / github.com/rilldata/rill / PingCmd

Function PingCmd

cli/cmd/admin/ping.go:11–41  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

9)
10
11func PingCmd(ch *cmdutil.Helper) *cobra.Command {
12 var adminURL string
13
14 pingCmd := &cobra.Command{
15 Use: "ping",
16 Short: "Ping",
17 RunE: func(cmd *cobra.Command, args []string) error {
18 // Must set here to avoid flag parser overriding it globally
19 ch.AdminURLOverride = adminURL
20
21 client, err := ch.Client()
22 if err != nil {
23 return err
24 }
25
26 ch.Printf("Ping: %s\n", time.Now().UTC().String())
27
28 pong, err := client.Ping(cmd.Context(), &adminv1.PingRequest{})
29 if err != nil {
30 return err
31 }
32
33 ch.Printf("Pong: %s\n", pong.Time.AsTime().String())
34 return nil
35 },
36 }
37
38 pingCmd.Flags().StringVar(&adminURL, "url", "https://admin.rilldata.com", "Base URL for the admin API")
39
40 return pingCmd
41}

Callers 1

AdminCmdFunction · 0.70

Calls 5

PrintfMethod · 0.80
StringMethod · 0.65
PingMethod · 0.65
ContextMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected