-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.go
170 lines (146 loc) · 5.67 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package http
import (
"fmt"
"time"
"github.com/lunarway/release-manager/internal/artifact"
)
type StatusRequest struct {
Service string `json:"service,omitempty"`
}
type StatusResponse struct {
DefaultNamespaces bool `json:"defaultNamespaces,omitempty"`
Dev *Environment `json:"dev,omitempty"`
Staging *Environment `json:"staging,omitempty"`
Prod *Environment `json:"prod,omitempty"`
}
type Environment struct {
Tag string `json:"tag,omitempty"`
Committer string `json:"committer,omitempty"`
Author string `json:"author,omitempty"`
Message string `json:"message,omitempty"`
Date int64 `json:"date,omitempty"`
BuildUrl string `json:"buildUrl,omitempty"`
HighVulnerabilities int64 `json:"highVulnerabilities,omitempty"`
MediumVulnerabilities int64 `json:"mediumVulnerabilities,omitempty"`
LowVulnerabilities int64 `json:"lowVulnerabilities,omitempty"`
}
type PromoteRequest struct {
Service string `json:"service,omitempty"`
Namespace string `json:"namespace,omitempty"`
Environment string `json:"environment,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`
}
type PromoteResponse struct {
Service string `json:"service,omitempty"`
FromEnvironment string `json:"fromEnvironment,omitempty"`
Status string `json:"status,omitempty"`
ToEnvironment string `json:"toEnvironment,omitempty"`
Tag string `json:"tag,omitempty"`
}
type ErrorResponse struct {
Status int `json:"status,omitempty"`
Message string `json:"message,omitempty"`
ID string `json:"-"`
}
var _ error = &ErrorResponse{}
func (e *ErrorResponse) Error() string {
if e.ID != "" {
return fmt.Sprintf("%s\nReference: %s", e.Message, e.ID)
}
return e.Message
}
type ReleaseRequest struct {
Service string `json:"service,omitempty"`
Environment string `json:"environment,omitempty"`
Branch string `json:"branch,omitempty"`
ArtifactID string `json:"artifactId,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`
}
type ReleaseResponse struct {
Service string `json:"service,omitempty"`
ReleaseID string `json:"releaseId,omitempty"`
Status string `json:"status,omitempty"`
ToEnvironment string `json:"toEnvironment,omitempty"`
Tag string `json:"tag,omitempty"`
}
type PodNotifyRequest struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
State string `json:"state"`
Reason string `json:"reason"`
Message string `json:"message"`
Containers []Container `json:"containers"`
ArtifactID string `json:"artifactId"`
Logs string `json:"logs"`
Environment string `json:"environment"`
CommitterEmail string `json:"committerEmail"`
AuthorEmail string `json:"authorEmail"`
}
type Container struct {
Name string `json:"name"`
State string `json:"state"`
Reason string `json:"reason"`
Message string `json:"message"`
Ready bool `json:"ready"`
RestartCount int32 `json:"restartCount"`
}
type ListPoliciesResponse struct {
Service string `json:"service,omitempty"`
AutoReleases []AutoReleasePolicy `json:"autoReleases,omitempty"`
}
type AutoReleasePolicy struct {
ID string `json:"id,omitempty"`
Branch string `json:"branch,omitempty"`
Environment string `json:"environment,omitempty"`
}
type ApplyAutoReleasePolicyRequest struct {
Service string `json:"service,omitempty"`
Branch string `json:"branch,omitempty"`
Environment string `json:"environment,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`
}
type ApplyPolicyResponse struct {
ID string `json:"id,omitempty"`
Service string `json:"service,omitempty"`
Branch string `json:"branch,omitempty"`
Environment string `json:"environment,omitempty"`
}
type DeletePolicyRequest struct {
Service string `json:"service,omitempty"`
PolicyIDs []string `json:"policyIds,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`
}
type DeletePolicyResponse struct {
Service string `json:"service,omitempty"`
Count int `json:"count,omitempty"`
}
type RollbackRequest struct {
Service string `json:"service,omitempty"`
Namespace string `json:"namespace,omitempty"`
Environment string `json:"environment,omitempty"`
CommitterName string `json:"committerName,omitempty"`
CommitterEmail string `json:"committerEmail,omitempty"`
}
type RollbackResponse struct {
Service string `json:"service,omitempty"`
Status string `json:"status,omitempty"`
Environment string `json:"environment,omitempty"`
PreviousArtifactID string `json:"previousArtifactId,omitempty"`
NewArtifactID string `json:"newArtifactId,omitempty"`
}
type DescribeReleaseResponse struct {
Service string `json:"service,omitempty"`
Environment string `json:"environment,omitempty"`
Artifact artifact.Spec `json:"artifact,omitempty"`
ReleasedAt time.Time `json:"releasedAt,omitempty"`
ReleasedByEmail string `json:"releasedByEmail,omitempty"`
ReleasedByName string `json:"releasedByName,omitempty"`
}
type DescribeArtifactResponse struct {
Service string `json:"service,omitempty"`
Artifacts []artifact.Spec `json:"artifacts,omitempty"`
}