forked from wise2c-devops/pagoda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster.go
73 lines (63 loc) · 2.15 KB
/
cluster.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
package database
import (
"time"
)
const (
Initial = "initial"
Processing = "processing"
Success = "success"
Failed = "failed"
)
type Cluster struct {
ID string `xorm:"varchar(255) notnull pk 'id'" json:"id"`
Name string `xorm:"varchar(255) notnull unique 'name'" json:"name"`
Description string `xorm:"varchar(255) 'description'" json:"description"`
State string `xorm:"varchar(255) 'state'" json:"state"`
Hosts []*Host `xorm:"-" json:"hosts,omitempty"`
Components []*Component `xorm:"-" json:"components,omitempty"`
}
type ClusterHost struct {
ClusterID string `xorm:"varchar(255) notnull pk 'cluster_id'"`
HostID string `xorm:"varchar(255) notnull pk 'host_id'"`
IP string `xorm:"varchar(25) notnull unique 'ip'"`
Hostname string `xorm:"varchar(255) notnull unique 'hostname'"`
Host *Host `xorm:"json notnull 'host'"`
}
type Host struct {
ID string `json:"id"`
HostName string `json:"hostname"`
IP string `json:"ip"`
Description string `json:"description"`
}
type ClusterComponent struct {
ClusterID string `xorm:"varchar(255) notnull pk 'cluster_id'"`
ComponentID string `xorm:"varchar(255) notnull pk 'component_id'"`
ComponentName string `xorm:"varchar(255) notnull 'component_name'"`
Component *Component `xorm:"json notnull 'component'"`
}
type Component struct {
MetaComponent
Hosts map[string][]string `json:"hosts"`
}
type ClusterLog struct {
ClusterID string `xorm:"varchar(255) notnull 'cluster_id'"`
Created time.Time `xorm:"created"`
Log *Notification `xorm:"json notnull 'log'"`
}
type Notification struct {
Data map[string]interface{} `json:"data"`
Now string `json:"time"`
Task struct {
Name string `json:"name"`
State string `json:"state"`
} `json:"task"`
Stage string `json:"stage"`
State string `json:"state"`
Host string `json:"host"`
}
type MetaComponent struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Property map[string]interface{} `json:"properties"`
}