-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
169 lines (137 loc) · 4.94 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
package cidsdk
import (
"strconv"
"time"
)
// APIError defines model for Error.
type APIError struct {
Detail string `json:"detail,omitempty"`
Status int `json:"status,omitempty"`
Title string `json:"title,omitempty"`
}
func (e *APIError) Error() string {
return strconv.Itoa(e.Status) + ": " + e.Title
}
// Action is the common interface for all actions
type Action interface {
Execute() error
}
// HealthcheckResponse defines model for HealthcheckResponse.
type HealthcheckResponse struct {
Status string `json:"status"`
}
// ProjectDependency defines model for ProjectDependency.
type ProjectDependency struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
}
// CurrentConfig defines model for CurrentConfig.
type CurrentConfig struct {
Debug bool `json:"debug,omitempty"`
Log map[string]string `json:"log,omitempty"`
ProjectDir string `json:"project_dir,omitempty"`
TempDir string `json:"temp_dir,omitempty"`
ArtifactDir string `json:"artifact_dir,omitempty"`
HostName string `json:"host_name,omitempty"`
HostUserId string `json:"host_user_id,omitempty"`
HostUserName string `json:"host_user_name,omitempty"`
HostGroupId string `json:"host_group_id,omitempty"`
Config string `json:"config,omitempty"`
}
func (c CurrentConfig) DebugFlag(id string, flag string) string {
if c.Debug || c.Log[id] == "debug" {
return flag
}
return ""
}
// ProjectModule defines model for ProjectModule.
type ProjectModule struct {
// ProjectDir project root directory
ProjectDir string `json:"project_dir,omitempty"`
// ModuleDir module root directory
ModuleDir string `json:"module_dir,omitempty"`
// Discovery module detected based on
Discovery []ProjectModuleDiscovery `json:"discovery,omitempty"`
// Name module name
Name string `json:"name,omitempty"`
// Slug module name
Slug string `json:"slug,omitempty"`
// Type is the module type
Type string `json:"type,omitempty"`
// BuildSystem module name
BuildSystem string `json:"build_system,omitempty"`
// BuildSystemSyntax module name
BuildSystemSyntax string `json:"build_system_syntax,omitempty"`
// SpecificationType is the type of the specification
SpecificationType string `json:"specification_type,omitempty"`
// Language module name
Language *map[string]string `json:"language,omitempty"`
// Dependencies module name
Dependencies *[]ProjectDependency `json:"dependencies,omitempty"`
// Files all files in the project directory
Files []string `json:"files,omitempty"`
// Submodules submodules
Submodules *[]ProjectModule `json:"submodules,omitempty"`
}
// ProjectModuleDiscovery contains info on the files used to discover the module
type ProjectModuleDiscovery struct {
File string `json:"file"`
}
type VCSCommit struct {
HashShort string `json:"hash_short,omitempty"`
Hash string `json:"hash,omitempty"`
Message string `json:"message,omitempty"`
Description string `json:"description,omitempty"`
Author VCSAuthor `json:"author,omitempty"`
Committer VCSAuthor `json:"committer,omitempty"`
Tags *[]VCSTag `json:"tags,omitempty"`
AuthoredAt time.Time `json:"authored_at,omitempty"`
CommittedAt time.Time `json:"committed_at,omitempty"`
Changes *[]VCSChange `json:"changes,omitempty"`
Context map[string]string `json:"context,omitempty"`
}
type VCSAuthor struct {
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
}
type VCSTag struct {
RefType string `json:"type,omitempty"`
Value string `json:"value,omitempty"`
Hash string `json:"hash,omitempty"`
}
type VCSRelease struct {
Version string `json:"version,omitempty"`
Ref VCSTag `json:"ref,omitempty"`
}
type VCSChange struct {
ChangeType string `json:"type,omitempty"`
FileFrom VCSFile `json:"file_from,omitempty"`
FileTo VCSFile `json:"file_to,omitempty"`
Patch string `json:"patch,omitempty"`
}
type VCSFile struct {
Name string `json:"name,omitempty"`
Size int `json:"size,omitempty"`
Hash string `json:"hash,omitempty"`
}
type VCSDiff struct {
FileFrom VCSFile `json:"file_from"`
FileTo VCSFile `json:"file_to"`
Lines []VCSDiffLine `json:"lines,omitempty"`
}
type VCSDiffLine struct {
Operation int `json:"operation"`
Content string `json:"content"`
}
// ActionArtifact contains information about generated artifacts
type ActionArtifact struct {
BuildID string `json:"build_id,omitempty"`
JobID string `json:"job_id,omitempty"`
ID string `json:"id,omitempty"`
Module string `json:"module,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Format string `json:"format,omitempty"`
FormatVersion string `json:"format_version,omitempty"`
}