-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathps.go
More file actions
46 lines (37 loc) · 1.4 KB
/
ps.go
File metadata and controls
46 lines (37 loc) · 1.4 KB
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
package api
import "github.com/drycc/controller-sdk-go/pkg/time"
// ProcessType represents the key/value mappings of a process type to a process inside
// a Heroku Procfile.
//
// See https://devcenter.heroku.com/articles/procfile
type ProcessType map[string]string
// Pods defines the structure of a process.
type Pods struct {
Release string `json:"release,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
State string `json:"state,omitempty"`
Started time.Time `json:"started,omitempty"`
Replicas int `json:"replicas,omitempty"`
}
// PodsList defines a collection of app pods.
type PodsList []Pods
func (p PodsList) Len() int { return len(p) }
func (p PodsList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p PodsList) Less(i, j int) bool { return p[i].Name < p[j].Name }
// PodType holds pods of the same type.
type PodType struct {
Type string
PodsList PodsList
Replicas int
Status string
}
// PodTypes holds groups of pods organized by type.
type PodTypes []PodType
// Start is the definition of POST /v2/apps/<app_id>/stop or POST /v2/apps/<app_id>/start.
type Types struct {
Types []string `json:"types,omitempty"`
}
func (p PodTypes) Len() int { return len(p) }
func (p PodTypes) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p PodTypes) Less(i, j int) bool { return p[i].Type < p[j].Type }