-
Notifications
You must be signed in to change notification settings - Fork 14
/
types.go
137 lines (123 loc) · 5.04 KB
/
types.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package gomarathon
// RequestOptions passed for query api
type RequestOptions struct {
Method string
Path string
Datas interface{}
Params *Parameters
}
// Parameters to build url query
type Parameters struct {
Cmd string
Host string
Scale bool
CallbackURL string
}
// Response representation of a full marathon response
type Response struct {
Code int
Apps []*Application `json:"apps,omitempty"`
App *Application `json:"app,omitempty"`
Versions []string `json:",omitempty"`
Tasks []*Task `json:"tasks,omitempty"`
}
// Application marathon application see :
// https://github.com/mesosphere/marathon/blob/master/REST.md#apps
type Application struct {
ID string `json:"id"`
Cmd string `json:"cmd,omitempty"`
Constraints [][]string `json:"constraints,omitempty"`
Container *Container `json:"container,omitempty"`
CPUs float32 `json:"cpus,omitempty"`
Deployments []*Deployment `json:"deployments,omitempty"`
Env map[string]string `json:"env,omitempty"`
Executor string `json:"executor,omitempty"`
HealthChecks []*HealthCheck `json:"healthChecks,omitempty"`
Instances int `json:"instances,omitemptys"`
Mem float32 `json:"mem,omitempty"`
Tasks []*Task `json:"tasks,omitempty"`
Ports []int `json:"ports,omitempty"`
RequirePorts bool `json:"requirePorts,omitempty"`
BackoffSeconds float64 `json:"backoffSeconds,omitempty"`
BackoffFactor float32 `json:"backoffFactor,omitempty"`
MaxLaunchDelaySeconds float64 `json:"maxLaunchDelaySeconds,omitempty"`
TasksRunning int `json:"tasksRunning,omitempty"`
TasksStaged int `json:"tasksStaged,omitempty"`
UpgradeStrategy *UpgradeStrategy `json:"upgradeStrategy,omitempty"`
Uris []string `json:"uris,omitempty"`
Version string `json:"version,omitempty"`
}
// Container is docker parameters
type Container struct {
Type string `json:"type,omitempty"`
Docker *Docker `json:"docker,omitempty"`
Volumes []*Volume `json:"volumes,omitempty"`
}
// Docker options
type Docker struct {
Image string `json:"image,omitempty"`
Network string `json:"network,omitempty"`
PortMappings []*PortMapping `json:"portMappings,omitempty"`
}
// Volume is used for mounting a host directory as a container volume
type Volume struct {
ContainerPath string `json:"containerPath,omitempty"`
HostPath string `json:"hostPath,omitempty"`
Mode string `json:"mode,omitempty"`
}
// Container PortMappings
type PortMapping struct {
ContainerPort int `json:"containerPort,omitempty"`
HostPort int `json:"hostPort,omitempty"`
ServicePort int `json:"servicePort,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
// UpgradeStrategy has a minimumHealthCapacity which defines the minimum number of healty nodes
type UpgradeStrategy struct {
MinimumHealthCapacity float32 `json:"minimumHealthCapacity,omitempty"`
}
// HealthCheck is described here:
// https://github.com/mesosphere/marathon/blob/master/REST.md#healthchecks
type HealthCheck struct {
Protocol string `json:"protocol,omitempty"`
Path string `json:"path,omitempty"`
GracePeriodSeconds int `json:"gracePeriodSeconds,omitempty"`
IntervalSeconds int `json:"intervalSeconds,omitempty"`
PortIndex int `json:"portIndex,omitempty"`
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
}
// Task is described here:
// https://github.com/mesosphere/marathon/blob/master/REST.md#tasks
type Task struct {
AppID string `json:"appId"`
Host string `json:"host"`
ID string `json:"id"`
Ports []int `json:"ports"`
StagedAt string `json:"stagedAt"`
StartedAt string `json:"startedAt"`
Version string `json:"version"`
}
// Deployment is described here:
// https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/deployments
type Deployment struct {
AffectedApps []string `json:"affectedApps"`
ID string `json:"id"`
Steps []*DeploymentStep `json:"steps"`
CurrentActions []*DeploymentStep `json:"currentActions"`
CurrentStep int `json:"currentStep"`
TotalSteps int `json:"totalSteps"`
Version string `json:"version"`
}
// Deployment steps
type DeploymentStep struct {
Action string `json:"action"`
App string `json:"app"`
}
// EventSubscription is described here:
// https://github.com/mesosphere/marathon/blob/master/REST.md#event-subscriptions
type EventSubscription struct {
CallbackURL string `json:"CallbackUrl"`
ClientIP string `json:"ClientIp"`
EventType string `json:"eventType"`
CallbackURLs []string `json:"CallbackUrls"`
}