-
Notifications
You must be signed in to change notification settings - Fork 55
/
ping.go
49 lines (40 loc) · 989 Bytes
/
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
47
48
49
package generic
import (
"github.com/jfrog/jfrog-cli-core/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/utils/config"
)
type PingCommand struct {
serverDetails *config.ServerDetails
response []byte
}
func NewPingCommand() *PingCommand {
return &PingCommand{}
}
func (pc *PingCommand) Response() []byte {
return pc.response
}
func (pc *PingCommand) ServerDetails() (*config.ServerDetails, error) {
return pc.serverDetails, nil
}
func (pc *PingCommand) SetServerDetails(serverDetails *config.ServerDetails) *PingCommand {
pc.serverDetails = serverDetails
return pc
}
func (pc *PingCommand) CommandName() string {
return "rt_ping"
}
func (pc *PingCommand) Run() error {
var err error
pc.response, err = pc.Ping()
if err != nil {
return err
}
return nil
}
func (pc *PingCommand) Ping() ([]byte, error) {
servicesManager, err := utils.CreateServiceManager(pc.serverDetails, -1, false)
if err != nil {
return nil, err
}
return servicesManager.Ping()
}