-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
data-contracts.ts
370 lines (343 loc) · 11.7 KB
/
data-contracts.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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
/** WatcherRegistrationRequest */
export interface WatcherRegistrationRequest {
machine_id: string;
/** @format password */
password: string;
}
/** WatcherAuthRequest */
export interface WatcherAuthRequest {
machine_id: string;
/** @format password */
password: string;
/** the list of scenarios enabled on the watcher */
scenarios?: string[];
}
/**
* WatcherAuthResponse
* the response of a successful authentication
*/
export interface WatcherAuthResponse {
code?: number;
expire?: string;
token?: string;
}
/** Alert */
export interface Alert {
/** only relevant for GET, ignored in POST requests */
id?: number;
/** only relevant for LAPI->CAPI, ignored for cscli->LAPI and crowdsec->LAPI */
uuid?: string;
/** only relevant for LAPI->CAPI, ignored for cscli->LAPI and crowdsec->LAPI */
machine_id?: string;
/** only relevant for GET, ignored in POST requests */
created_at?: string;
scenario: string;
scenario_hash: string;
scenario_version: string;
/** a human readable message */
message: string;
/** @format int32 */
events_count: number;
start_at: string;
stop_at: string;
/** @format int32 */
capacity: number;
leakspeed: string;
simulated: boolean;
/** the Meta of the events leading to overflow */
events: Event[];
remediation?: boolean;
decisions?: Decision[];
source: Source;
/** the Meta data of the Alert itself */
meta?: Meta;
labels?: string[];
}
/** Source */
export interface Source {
/** the scope of a source : ip,range,username,etc */
scope: string;
/** the value of a source : the ip, the range, the username,etc */
value: string;
/** provided as a convenience when the source is an IP */
ip?: string;
/** provided as a convenience when the source is an IP */
range?: string;
/** provided as a convenience when the source is an IP */
as_number?: string;
/** provided as a convenience when the source is an IP */
as_name?: string;
cn?: string;
/** @format float */
latitude?: number;
/** @format float */
longitude?: number;
}
/** Metrics */
export interface Metrics {
/** the local version of crowdsec/apil */
apil_version: string;
bouncers: MetricsBouncerInfo[];
machines: MetricsAgentInfo[];
}
/**
* MetricsBouncerInfo
* Software version info (so we can warn users about out-of-date software). The software name and the version are "guessed" from the user-agent
*/
export interface MetricsBouncerInfo {
/** name of the component */
custom_name?: string;
/** bouncer type (firewall, php ...) */
name?: string;
/** software version */
version?: string;
/** last bouncer pull date */
last_pull?: string;
}
/**
* MetricsAgentInfo
* Software version info (so we can warn users about out-of-date software). The software name and the version are "guessed" from the user-agent
*/
export interface MetricsAgentInfo {
/** name of the component */
name?: string;
/** software version */
version?: string;
/** last agent update date */
last_update?: string;
/** last agent push date */
last_push?: string;
}
/** Decision */
export interface Decision {
/** (only relevant for GET ops) the unique id */
id?: number;
/** only relevant for LAPI->CAPI, ignored for cscli->LAPI and crowdsec->LAPI */
uuid?: string;
/** the origin of the decision : cscli, crowdsec */
origin: string;
/** the type of decision, might be 'ban', 'captcha' or something custom. Ignored when watcher (cscli/crowdsec) is pushing to APIL. */
type: string;
/** the scope of decision : does it apply to an IP, a range, a username, etc */
scope: string;
/** the value of the decision scope : an IP, a range, a username, etc */
value: string;
/** the duration of the decisions */
duration: string;
/** the date until the decisions must be active */
until?: string;
scenario: string;
/** true if the decision result from a scenario in simulation mode */
simulated?: boolean;
}
/** DeleteDecisionResponse */
export interface DeleteDecisionResponse {
/** number of deleted decisions */
nbDeleted?: string;
}
/** AddAlertsRequest */
export type AddAlertsRequest = Alert[];
/** AddAlertsResponse */
export type AddAlertsResponse = string[];
/** AlertsResponse */
export type GetAlertsResponse = Alert[];
/** DeleteAlertsResponse */
export interface DeleteAlertsResponse {
/** number of deleted alerts */
nbDeleted?: string;
}
/** DecisionsStreamResponse */
export interface DecisionsStreamResponse {
new?: GetDecisionsResponse;
deleted?: GetDecisionsResponse;
}
/** Event */
export interface Event {
timestamp: string;
/** the Meta data of the Alert itself */
meta: Meta;
}
/** GetDecisionsResponse */
export type GetDecisionsResponse = Decision[];
/**
* Meta
* the Meta data of the Alert itself
*/
export type Meta = {
key?: string;
value?: string;
}[];
/**
* error response
* error response return by the API
*/
export interface ErrorResponse {
/** Error message */
message: string;
/** more detail on individual errors */
errors?: string;
}
export interface GetDecisionsStreamParams {
/** If true, means that the bouncers is starting and a full list must be provided */
startup?: boolean;
/** Comma separated scopes of decisions to fetch */
scopes?: string;
/** Comma separated name of origins. If provided, then only the decisions originating from provided origins would be returned. */
origins?: string;
/** Comma separated words. If provided, only the decisions created by scenarios containing any of the provided word would be returned. */
scenarios_containing?: string;
/** Comma separated words. If provided, only the decisions created by scenarios, not containing any of the provided word would be returned. */
scenarios_not_containing?: string;
}
export interface HeadDecisionsStreamParams {
/** If true, means that the bouncer is starting and a full list must be provided */
startup?: boolean;
}
export interface GetDecisionsParams {
/** scope to which the decision applies (ie. IP/Range/Username/Session/...) */
scope?: string;
/** the value to match for in the specified scope */
value?: string;
/** type of decision */
type?: string;
/** IP to search for (shorthand for scope=ip&value=) */
ip?: string;
/** range to search for (shorthand for scope=range&value=) */
range?: string;
/** indicate if you're looking for a decision that contains the value, or that is contained within the value */
contains?: boolean;
/** Comma separated name of origins. If provided, then only the decisions originating from provided origins would be returned. */
origins?: string;
/** Comma separated words. If provided, only the decisions created by scenarios containing any of the provided word would be returned. */
scenarios_containing?: string;
/** Comma separated words. If provided, only the decisions created by scenarios, not containing any of the provided word would be returned. */
scenarios_not_containing?: string;
}
export interface HeadDecisionsParams {
/** scope to which the decision applies (ie. IP/Range/Username/Session/...) */
scope?: string;
/** the value to match for in the specified scope */
value?: string;
/** type of decision */
type?: string;
/** IP to search for (shorthand for scope=ip&value=) */
ip?: string;
/** range to search for (shorthand for scope=range&value=) */
range?: string;
/** indicate if you're looking for a decision that contains the value, or that is contained within the value */
contains?: boolean;
}
export interface DeleteDecisionsParams {
/** scope to which the decision applies (ie. IP/Range/Username/Session/...) */
scope?: string;
/** the value to match for in the specified scope */
value?: string;
/** type of decision */
type?: string;
/** IP to search for (shorthand for scope=ip&value=) */
ip?: string;
/** range to search for (shorthand for scope=range&value=) */
range?: string;
/** scenario to search */
scenario?: string;
}
export interface SearchAlertsParams {
/** show alerts for this scope */
scope?: string;
/** show alerts for this value (used with scope) */
value?: string;
/** show alerts for this scenario */
scenario?: string;
/** IP to search for (shorthand for scope=ip&value=) */
ip?: string;
/** range to search for (shorthand for scope=range&value=) */
range?: string;
/**
* search alerts newer than delay (format must be compatible with time.ParseDuration)
* @format date-time
*/
since?: string;
/**
* search alerts older than delay (format must be compatible with time.ParseDuration)
* @format date-time
*/
until?: string;
/** if set to true, decisions in simulation mode will be returned as well */
simulated?: boolean;
/** only return alerts with decisions not expired yet */
has_active_decision?: boolean;
/** restrict results to alerts with decisions matching given type */
decision_type?: string;
/** number of alerts to return */
limit?: number;
/** restrict results to this origin (ie. lists,CAPI,cscli) */
origin?: string;
}
export interface HeadAlertsParams {
/** show alerts for this scope */
scope?: string;
/** show alerts for this value (used with scope) */
value?: string;
/** show alerts for this scenario */
scenario?: string;
/** IP to search for (shorthand for scope=ip&value=) */
ip?: string;
/** range to search for (shorthand for scope=range&value=) */
range?: string;
/**
* search alerts newer than delay (format must be compatible with time.ParseDuration)
* @format date-time
*/
since?: string;
/**
* search alerts older than delay (format must be compatible with time.ParseDuration)
* @format date-time
*/
until?: string;
/** if set to true, decisions in simulation mode will be returned as well */
simulated?: boolean;
/** only return alerts with decisions not expired yet */
has_active_decision?: boolean;
/** restrict results to alerts with decisions matching given type */
decision_type?: string;
/** number of alerts to return */
limit?: number;
/** restrict results to this origin (ie. lists,CAPI,cscli) */
origin?: string;
}
export interface DeleteAlertsParams {
/** delete alerts for this scope */
scope?: string;
/** delete alerts for this value (used with scope) */
value?: string;
/** delete alerts for this scenario */
scenario?: string;
/** delete Alerts with IP (shorthand for scope=ip&value=) */
ip?: string;
/** delete alerts concerned by range (shorthand for scope=range&value=) */
range?: string;
/**
* delete alerts added after YYYY-mm-DD-HH:MM:SS
* @format date-time
*/
since?: string;
/**
* delete alerts added before YYYY-mm-DD-HH:MM:SS
* @format date-time
*/
until?: string;
/** delete only alerts with decisions not expired yet */
has_active_decision?: boolean;
/** delete only alerts with matching source (ie. cscli/crowdsec) */
alert_source?: string;
}