-
Notifications
You must be signed in to change notification settings - Fork 0
/
versions.go
66 lines (57 loc) · 1.21 KB
/
versions.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
package gofiery
import (
"net/http"
"time"
)
type Version struct {
Apache ApacheVersion
FieryAPI FieryAPIVersion `json:"fieryApi"`
Gems []interface{}
OpenSSL OpenSSLVersion `json:"openSsl"`
Rhythm RhythmVersion
Ruby RubyVersion
}
type ApacheVersion struct {
Version string
Platform string
BuiltDate time.Time `json:"builtDate"`
}
type FieryAPIVersion struct {
Version string
InstalledDate time.Time `json:"installedDate"`
}
type OpenSSLVersion struct {
Version string
BuiltDate time.Time `json:"builtDate"`
}
type RhythmVersion struct {
Version string
}
type RubyVersion struct {
Version string
}
func (fc *FieryClient) GetVersions() *Version {
var versions Version
response := fc.Run(fc.Endpoint("versions"), http.MethodGet)
versions = response.data.item.(Version)
return &versions
}
func (fc *FieryClient) GetVersion(of string) any {
var version any
versions := fc.GetVersions()
switch of {
case "apache":
version = versions.Apache
case "fieryApi":
version = versions.FieryAPI
case "gems":
version = versions.Gems
case "openSsl":
version = versions.OpenSSL
case "rhythm":
version = versions.Rhythm
case "ruby":
version = versions.Ruby
}
return &version
}