-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstalker-structs.go
63 lines (54 loc) · 1.51 KB
/
stalker-structs.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
package main
import (
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types"
)
func GetStalkerPorts(ports []types.Port) []*StalkerPort {
containerPorts := []*StalkerPort{}
//loop and create
for _, p := range ports {
containerPorts = append(containerPorts, &StalkerPort{
Private: p.PrivatePort,
Public: p.PublicPort,
Type: p.Type,
})
}
return containerPorts
}
func GetStalkerMounts(mounts []types.MountPoint) []*StalkerMount {
containerMounts := []*StalkerMount{}
//loop and create
for _, m := range mounts {
containerMounts = append(containerMounts, &StalkerMount{
Type: m.Type,
Source: m.Source,
Destination: m.Destination,
})
}
return containerMounts
}
type StalkerContainer struct {
Name string `json:"name"`
Image string `json:"image"`
Created int64 `json:"created"`
Status string `json:"status"`
State string `json:"state"`
ContainerId string `json:"containerId"`
}
type StalkerContainerDetail struct {
Ports []*StalkerPort `json:"ports"`
Mounts []*StalkerMount `json:"mounts"`
EnvVars []string `json:"envVars"`
Networks []string `json:"networks"`
*StalkerContainer
}
type StalkerPort struct {
Private uint16 `json:"private"`
Public uint16 `json:"public"`
Type string `json:"type"`
}
type StalkerMount struct {
Type mount.Type `json:"type"`
Source string `json:"source"`
Destination string `json:"destination"`
}