-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
interface.ts
246 lines (225 loc) · 4.55 KB
/
interface.ts
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/**
* The base interface contains the general properties
*
* @export
* @interface Base
*/
export interface Base {
id?: string | number;
name?: string;
creation_time?: Date;
update_time?: Date;
}
/**
* Interface for Repository Info
*
* @export
* @interface Repository
* @extends {Base}
*/
export interface RepositoryItem extends Base {
[key: string]: any | any[]
name: string;
tags_count: number;
owner_id?: number;
project_id?: number;
description?: string;
star_count?: number;
pull_count?: number;
}
/**
* Interface for repository
*
* @export
* @interface Repository
*/
export interface Repository {
metadata?: Metadata;
data: RepositoryItem[];
}
/**
* Interface for the tag of repository
*
* @export
* @interface Tag
* @extends {Base}
*/
export interface Tag extends Base {
digest: string;
name: string;
size: string;
architecture: string;
os: string;
docker_version: string;
author: string;
created: Date;
signature?: string;
scan_overview?: VulnerabilitySummary;
}
/**
* Interface for registry endpoints.
*
* @export
* @interface Endpoint
* @extends {Base}
*/
export interface Endpoint extends Base {
endpoint: string;
name: string;
username?: string;
password?: string;
insecure: boolean;
type: number;
[key: string]: any;
}
/**
* Interface for replication rule.
*
* @export
* @interface ReplicationRule
*/
export interface ReplicationRule extends Base {
project_id: number | string;
project_name: string;
target_id: number | string;
target_name: string;
enabled: number;
description?: string;
cron_str?: string;
start_time?: Date;
error_job_count?: number;
deleted: number;
}
/**
* Interface for replication job.
*
* @export
* @interface ReplicationJob
*/
export interface ReplicationJob {
metadata?: Metadata;
data: ReplicationJobItem[];
}
/**
* Interface for replication job item.
*
* @export
* @interface ReplicationJob
*/
export interface ReplicationJobItem extends Base {
[key: string]: any | any[]
status: string;
repository: string;
policy_id: number;
operation: string;
tags: string;
}
/**
* Interface for storing metadata of response.
*
* @export
* @interface Metadata
*/
export interface Metadata {
xTotalCount: number;
}
/**
* Interface for access log.
*
* @export
* @interface AccessLog
*/
export interface AccessLog {
metadata?: Metadata;
data: AccessLogItem[];
}
/**
* The access log data.
*
* @export
* @interface AccessLogItem
*/
export interface AccessLogItem {
[key: string]: any | any[]
log_id: number;
project_id: number;
repo_name: string;
repo_tag: string;
operation: string;
op_time: string | Date;
user_id: number;
username: string;
keywords?: string; //NOT used now
guid?: string; //NOT used now
}
/**
* Global system info.
*
* @export
* @interface SystemInfo
*
*/
export interface SystemInfo {
with_clair?: boolean;
with_notary?: boolean;
with_admiral?: boolean;
admiral_endpoint?: string;
auth_mode?: string;
registry_url?: string;
project_creation_restriction?: string;
self_registration?: boolean;
has_ca_root?: boolean;
harbor_version?: string;
clair_vulnerability_status?: ClairDBStatus;
next_scan_all?: number;
}
/**
* Clair database status info.
*
* @export
* @interface ClairDetail
*/
export interface ClairDetail {
namespace: string;
last_update: number;
}
export interface ClairDBStatus {
overall_last_update: number;
details: ClairDetail[];
}
export enum VulnerabilitySeverity {
_SEVERITY, NONE, UNKNOWN, LOW, MEDIUM, HIGH
}
export interface VulnerabilityBase {
id: string;
severity: VulnerabilitySeverity;
package: string;
version: string;
}
export interface VulnerabilityItem extends VulnerabilityBase {
link: string;
fixedVersion: string;
layer?: string;
description: string;
}
export interface VulnerabilitySummary {
image_digest?: string;
scan_status: string;
job_id?: number;
severity: VulnerabilitySeverity;
components: VulnerabilityComponents;
update_time: Date; //Use as complete timestamp
}
export interface VulnerabilityComponents {
total: number;
summary: VulnerabilitySeverityMetrics[];
}
export interface VulnerabilitySeverityMetrics {
severity: VulnerabilitySeverity;
count: number;
}
export interface TagClickEvent {
project_id: string | number;
repository_name: string;
tag_name: string;
}