-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_ping.go
46 lines (38 loc) · 968 Bytes
/
cmd_ping.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package client
import (
"fmt"
"github.com/keybase/cli"
"github.com/keybase/client/go/libcmdline"
"github.com/keybase/client/go/libkb"
)
type CmdPing struct{}
func (v *CmdPing) Run() error {
_, err := G.API.Post(libkb.APIArg{Endpoint: "ping"})
if err != nil {
return err
}
_, err = G.API.Get(libkb.APIArg{Endpoint: "ping"})
if err != nil {
return err
}
G.Log.Info(fmt.Sprintf("API Server at %s is up", G.Env.GetServerURI()))
return nil
}
func NewCmdPing(cl *libcmdline.CommandLine) cli.Command {
return cli.Command{
Name: "ping",
Usage: "Ping the keybase API server",
Action: func(c *cli.Context) {
cl.ChooseCommand(&CmdPing{}, "ping", c)
},
}
}
func (v *CmdPing) ParseArgv(*cli.Context) error { return nil }
func (v *CmdPing) GetUsage() libkb.Usage {
return libkb.Usage{
Config: true,
API: true,
}
}