forked from cvbarros/go-teamcity
/
server.go
92 lines (63 loc) · 1.98 KB
/
server.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package teamcity
import "github.com/dghubble/sling"
// Server holds information about the TeamCity server
type Server struct {
// agent pools
// AgentPools string `json:"agentPools,omitempty"`
// agents
// Agents string `json:"agents,omitempty"`
// build date
BuildDate string `json:"buildDate,omitempty" xml:"buildDate"`
// build number
BuildNumber string `json:"buildNumber,omitempty" xml:"buildNumber"`
// build queue
// BuildQueue string `json:"buildQueue,omitempty"`
// builds
// Builds string `json:"builds,omitempty"`
// current time
CurrentTime string `json:"currentTime,omitempty" xml:"currentTime"`
// internal Id
InternalID string `json:"internalId,omitempty" xml:"internalId"`
// version
Version string `json:"version,omitempty" xml:"version"`
// version major
VersionMajor int32 `json:"versionMajor,omitempty" xml:"versionMajor"`
// version minor
VersionMinor int32 `json:"versionMinor,omitempty" xml:"versionMinor"`
// web Url
WebURL string `json:"webUrl,omitempty" xml:"webUrl"`
// // investigations
// Investigations string `json:"investigations,omitempty"`
// // mutes
// Mutes string `json:"mutes,omitempty"`
// // projects
// Projects string `json:"projects,omitempty"`
// // role
// Role string `json:"role,omitempty" xml:"role"`
// // start time
// StartTime string `json:"startTime,omitempty" xml:"startTime"`
// // user groups
// UserGroups string `json:"userGroups,omitempty"`
// // users
// Users string `json:"users,omitempty"`
// // vcs roots
// VcsRoots string `json:"vcsRoots,omitempty"`
}
// ServerService allows retrieving information about the server
type ServerService struct {
sling *sling.Sling
}
func newServerService(base *sling.Sling) *ServerService {
return &ServerService{
sling: base.Get("server/"),
}
}
// Get returns a struct with server information
func (s *ServerService) Get() (*Server, error) {
var out Server
_, err := s.sling.ReceiveSuccess(&out)
if err != nil {
return nil, err
}
return &out, nil
}