This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.go
125 lines (108 loc) · 4.01 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
package types
import (
"encoding/json"
"fmt"
"time"
)
type ExpandedFormation struct {
App *App `json:"app,omitempty"`
Release *Release `json:"release,omitempty"`
Artifact *Artifact `json:"artifact,omitempty"`
Processes map[string]int `json:"processes,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type App struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Protected bool `json:"protected"`
Meta map[string]string `json:"meta,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
type Release struct {
ID string `json:"id,omitempty"`
ArtifactID string `json:"artifact,omitempty"`
Env map[string]string `json:"env,omitempty"`
Processes map[string]ProcessType `json:"processes,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
}
type ProcessType struct {
Cmd []string `json:"cmd,omitempty"`
Env map[string]string `json:"env,omitempty"`
Ports ProcessPorts `json:"ports,omitempty"`
Data bool `json:"data,omitempty"`
Omni bool `json:"omni,omitempty"` // omnipresent - present on all hosts
}
type ProcessPorts struct {
TCP int `json:"tcp,omitempty"`
UDP int `json:"udp,omitempty"`
}
type Artifact struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
URI string `json:"uri,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
}
type Formation struct {
AppID string `json:"app,omitempty"`
ReleaseID string `json:"release,omitempty"`
Processes map[string]int `json:"processes,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
type Key struct {
ID string `json:"fingerprint,omitempty"`
Key string `json:"key,omitempty"`
Comment string `json:"comment,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
}
type Job struct {
ID string `json:"id,omitempty"`
AppID string `json:"app,omitempty"`
ReleaseID string `json:"release,omitempty"`
Type string `json:"type,omitempty"`
State string `josn:"state,omitempty"`
Cmd []string `json:"cmd,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
type NewJob struct {
ReleaseID string `json:"release,omitempty"`
Cmd []string `json:"cmd,omitempty"`
Env map[string]string `json:"env,omitempty"`
TTY bool `json:"tty,omitempty"`
Columns int `json:"tty_columns,omitempty"`
Lines int `json:"tty_lines,omitempty"`
}
type Frontend struct {
Type string `json:"type,omitempty"`
HTTPDomain string `json:"http_domain,omitempty"`
Service string `json:"service,omitempty"`
}
type Provider struct {
ID string `json:"id,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
type Resource struct {
ID string `json:"id,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Env map[string]string `json:"env,omitempty"`
Apps []string `json:"apps,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
}
type ResourceReq struct {
ProviderID string `json:"-"`
Apps []string `json:"apps,omitempty"`
Config *json.RawMessage `json:"config"`
}
type ValidationError struct {
Field string `json:"field,omitempty"`
Message string `json:"message"`
}
func (v ValidationError) Error() string {
return fmt.Sprintf("validation error: %s %s", v.Field, v.Message)
}