forked from cloudfoundry/auctioneer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subjects.go
41 lines (37 loc) · 1.29 KB
/
subjects.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
package nats
import "reflect"
type Subjects struct {
TotalResources string
Reset string
SimulatedInstances string
SetSimulatedInstances string
BidForStartAuction string
BidForStopAuction string
RebidThenTentativelyReserve string
ReleaseReservation string
Run string
Stop string
}
func NewSubjects(repGuid string) Subjects {
return Subjects{
TotalResources: repGuid + ".total-resources",
Reset: repGuid + ".reset",
SimulatedInstances: repGuid + ".simulated-instances",
SetSimulatedInstances: repGuid + ".set-simulated-instances",
BidForStartAuction: repGuid + ".bid-for-start-auction",
BidForStopAuction: repGuid + ".bid-for-stop-auction",
RebidThenTentativelyReserve: repGuid + ".rebid-then-tentatively-reserve",
ReleaseReservation: repGuid + ".release-reservation",
Run: repGuid + ".run",
Stop: repGuid + ".stop",
}
}
func (subjects Subjects) Slice() []string {
val := reflect.ValueOf(subjects)
count := val.NumField()
out := make([]string, count)
for i := 0; i < count; i++ {
out[i] = val.Field(i).String()
}
return out
}