/
path.go
48 lines (36 loc) · 1.03 KB
/
path.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
package rest
import (
"fmt"
mtypes "github.com/virtengine/virtengine/x/market/types"
)
const (
deploymentPathPrefix = "/deployment/{dseq}"
leasePathPrefix = "/lease/{dseq}/{gseq}/{oseq}"
)
func statusPath() string {
return "status"
}
func validatePath() string {
return "validate"
}
func leasePath(id mtypes.LeaseID) string {
return fmt.Sprintf("lease/%d/%d/%d", id.DSeq, id.GSeq, id.OSeq)
}
func submitManifestPath(dseq uint64) string {
return fmt.Sprintf("deployment/%d/manifest", dseq)
}
func leaseStatusPath(id mtypes.LeaseID) string {
return fmt.Sprintf("%s/status", leasePath(id))
}
func leaseShellPath(lID mtypes.LeaseID) string {
return fmt.Sprintf("%s/shell", leasePath(lID))
}
func leaseEventsPath(id mtypes.LeaseID) string {
return fmt.Sprintf("%s/kubeevents", leasePath(id))
}
func serviceStatusPath(id mtypes.LeaseID, service string) string {
return fmt.Sprintf("%s/service/%s/status", leasePath(id), service)
}
func serviceLogsPath(id mtypes.LeaseID) string {
return fmt.Sprintf("%s/logs", leasePath(id))
}