/
event.go
45 lines (40 loc) · 1.25 KB
/
event.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
package proc
import (
"github.com/MagalixCorp/magalix-agent/watcher"
"github.com/MagalixTechnologies/uuid-go"
)
// Pod pod type
type Pod struct {
Name string `json:"name"`
ID string `json:"id"`
AccountID uuid.UUID `json:"account_id"`
ApplicationID uuid.UUID `json:"application_id"`
ServiceID uuid.UUID `json:"service_id"`
Status watcher.Status `json:"status"`
Containers map[uuid.UUID]ContainerState `json:"containers"`
}
// GetIdentity returns an identity for the pod
func (pod *Pod) GetIdentity() watcher.Identity {
return watcher.Identity{
AccountID: pod.AccountID,
ApplicationID: pod.ApplicationID,
ServiceID: pod.ServiceID,
}
}
// ReplicaSpec returns an identity for a replicated service
type ReplicaSpec struct {
Name string
ID string
AccountID uuid.UUID
ApplicationID uuid.UUID
ServiceID uuid.UUID
Replicas int
}
// GetIdentity returns an identity for the service
func (spec *ReplicaSpec) GetIdentity() watcher.Identity {
return watcher.Identity{
AccountID: spec.AccountID,
ApplicationID: spec.ApplicationID,
ServiceID: spec.ServiceID,
}
}