-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.go
35 lines (30 loc) · 899 Bytes
/
version.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
package webhookrelay
import (
"context"
"encoding/json"
)
// VersionInfo describes version and runtime info.
type VersionInfo struct {
Name string `json:"name"`
BuildDate string `json:"buildDate"`
Revision string `json:"revision"`
Version string `json:"version"`
APIVersion string `json:"apiVersion"`
GoVersion string `json:"goVersion"`
OS string `json:"os"`
Arch string `json:"arch"`
KernelVersion string `json:"kernelVersion"`
Experimental bool `json:"experimental"`
}
// ServerVersion returns the server's version and runtime info.
func (api *API) ServerVersion(ctx context.Context) (*VersionInfo, error) {
resp, err := api.makeRequest("GET", "/version", nil)
if err != nil {
return nil, err
}
var version VersionInfo
if err := json.Unmarshal(resp, &version); err != nil {
return nil, err
}
return &version, nil
}