@oneuptime/common 10.0.67 → 10.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/AuditLog.ts +370 -0
- package/Models/DatabaseModels/Alert.ts +2 -0
- package/Models/DatabaseModels/ApiKey.ts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +3 -0
- package/Models/DatabaseModels/Incident.ts +2 -0
- package/Models/DatabaseModels/KubernetesResource.ts +19 -0
- package/Models/DatabaseModels/Label.ts +2 -0
- package/Models/DatabaseModels/Monitor.ts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicy.ts +2 -0
- package/Models/DatabaseModels/Project.ts +80 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +2 -0
- package/Models/DatabaseModels/StatusPage.ts +2 -0
- package/Models/DatabaseModels/Team.ts +2 -0
- package/Models/DatabaseModels/UserTelegram.ts +1 -1
- package/Server/API/KubernetesResourceAPI.ts +2 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1776865086264-MigrationName.ts +14 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/AuditLogService.ts +574 -0
- package/Server/Services/DatabaseService.ts +103 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/KubernetesResourceService.ts +300 -8
- package/Server/Utils/VM/VMRunner.ts +39 -22
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +1 -0
- package/Types/AuditLog/AuditLogAction.ts +7 -0
- package/Types/BaseDatabase/EnableAuditLogOn.ts +5 -0
- package/Types/Database/EnableAuditLog.ts +18 -0
- package/Types/IsolatedVM/ReturnResult.ts +6 -0
- package/Types/Kubernetes/KubernetesInventoryExtractor.ts +15 -1
- package/Types/Permission.ts +13 -0
- package/build/dist/Models/AnalyticsModels/AuditLog.js +337 -0
- package/build/dist/Models/AnalyticsModels/AuditLog.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Alert.js +2 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ApiKey.js +2 -0
- package/build/dist/Models/DatabaseModels/ApiKey.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +2 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesResource.js +20 -0
- package/build/dist/Models/DatabaseModels/KubernetesResource.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Label.js +2 -0
- package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +2 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js +2 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +82 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +2 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +2 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Team.js +2 -0
- package/build/dist/Models/DatabaseModels/Team.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserTelegram.js +1 -1
- package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -1
- package/build/dist/Server/API/KubernetesResourceAPI.js +2 -0
- package/build/dist/Server/API/KubernetesResourceAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776865086264-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776865086264-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AuditLogService.js +402 -0
- package/build/dist/Server/Services/AuditLogService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseService.js +79 -8
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/KubernetesResourceService.js +202 -8
- package/build/dist/Server/Services/KubernetesResourceService.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +33 -19
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +1 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/AuditLog/AuditLogAction.js +8 -0
- package/build/dist/Types/AuditLog/AuditLogAction.js.map +1 -0
- package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js +2 -0
- package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js.map +1 -0
- package/build/dist/Types/Database/EnableAuditLog.js +15 -0
- package/build/dist/Types/Database/EnableAuditLog.js.map +1 -0
- package/build/dist/Types/Kubernetes/KubernetesInventoryExtractor.js +7 -1
- package/build/dist/Types/Kubernetes/KubernetesInventoryExtractor.js.map +1 -1
- package/build/dist/Types/Permission.js +11 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import AnalyticsBaseModel from "./AnalyticsBaseModel/AnalyticsBaseModel";
|
|
2
|
+
import Route from "../../Types/API/Route";
|
|
3
|
+
import AnalyticsTableEngine from "../../Types/AnalyticsDatabase/AnalyticsTableEngine";
|
|
4
|
+
import AnalyticsTableName from "../../Types/AnalyticsDatabase/AnalyticsTableName";
|
|
5
|
+
import AnalyticsTableColumn from "../../Types/AnalyticsDatabase/TableColumn";
|
|
6
|
+
import TableColumnType from "../../Types/AnalyticsDatabase/TableColumnType";
|
|
7
|
+
import { JSONArray } from "../../Types/JSON";
|
|
8
|
+
import ObjectID from "../../Types/ObjectID";
|
|
9
|
+
import Permission from "../../Types/Permission";
|
|
10
|
+
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
|
|
11
|
+
|
|
12
|
+
export default class AuditLog extends AnalyticsBaseModel {
|
|
13
|
+
public constructor() {
|
|
14
|
+
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
15
|
+
key: "projectId",
|
|
16
|
+
title: "Project ID",
|
|
17
|
+
description: "ID of the project this audit log belongs to.",
|
|
18
|
+
required: true,
|
|
19
|
+
type: TableColumnType.ObjectID,
|
|
20
|
+
isTenantId: true,
|
|
21
|
+
accessControl: {
|
|
22
|
+
read: [
|
|
23
|
+
Permission.ProjectOwner,
|
|
24
|
+
Permission.ProjectAdmin,
|
|
25
|
+
Permission.ReadAuditLog,
|
|
26
|
+
],
|
|
27
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
28
|
+
update: [],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const resourceTypeColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
33
|
+
key: "resourceType",
|
|
34
|
+
title: "Resource Type",
|
|
35
|
+
description:
|
|
36
|
+
"Type of the resource that was changed (e.g. Incident, Monitor).",
|
|
37
|
+
required: true,
|
|
38
|
+
type: TableColumnType.Text,
|
|
39
|
+
accessControl: {
|
|
40
|
+
read: [
|
|
41
|
+
Permission.ProjectOwner,
|
|
42
|
+
Permission.ProjectAdmin,
|
|
43
|
+
Permission.ReadAuditLog,
|
|
44
|
+
],
|
|
45
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
46
|
+
update: [],
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const resourceIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
51
|
+
key: "resourceId",
|
|
52
|
+
title: "Resource ID",
|
|
53
|
+
description: "ID of the resource that was changed.",
|
|
54
|
+
required: true,
|
|
55
|
+
type: TableColumnType.ObjectID,
|
|
56
|
+
accessControl: {
|
|
57
|
+
read: [
|
|
58
|
+
Permission.ProjectOwner,
|
|
59
|
+
Permission.ProjectAdmin,
|
|
60
|
+
Permission.ReadAuditLog,
|
|
61
|
+
],
|
|
62
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
63
|
+
update: [],
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const resourceNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
68
|
+
key: "resourceName",
|
|
69
|
+
title: "Resource Name",
|
|
70
|
+
description: "Display name of the resource at the time of the change.",
|
|
71
|
+
required: false,
|
|
72
|
+
type: TableColumnType.Text,
|
|
73
|
+
accessControl: {
|
|
74
|
+
read: [
|
|
75
|
+
Permission.ProjectOwner,
|
|
76
|
+
Permission.ProjectAdmin,
|
|
77
|
+
Permission.ReadAuditLog,
|
|
78
|
+
],
|
|
79
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
80
|
+
update: [],
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const actionColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
85
|
+
key: "action",
|
|
86
|
+
title: "Action",
|
|
87
|
+
description: "The action performed: Create, Update, or Delete.",
|
|
88
|
+
required: true,
|
|
89
|
+
type: TableColumnType.Text,
|
|
90
|
+
accessControl: {
|
|
91
|
+
read: [
|
|
92
|
+
Permission.ProjectOwner,
|
|
93
|
+
Permission.ProjectAdmin,
|
|
94
|
+
Permission.ReadAuditLog,
|
|
95
|
+
],
|
|
96
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
97
|
+
update: [],
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const userIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
102
|
+
key: "userId",
|
|
103
|
+
title: "User ID",
|
|
104
|
+
description: "ID of the user who performed the action, if any.",
|
|
105
|
+
required: false,
|
|
106
|
+
type: TableColumnType.ObjectID,
|
|
107
|
+
accessControl: {
|
|
108
|
+
read: [
|
|
109
|
+
Permission.ProjectOwner,
|
|
110
|
+
Permission.ProjectAdmin,
|
|
111
|
+
Permission.ReadAuditLog,
|
|
112
|
+
],
|
|
113
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
114
|
+
update: [],
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const userNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
119
|
+
key: "userName",
|
|
120
|
+
title: "User Name",
|
|
121
|
+
description: "Display name of the user at the time of the action.",
|
|
122
|
+
required: false,
|
|
123
|
+
type: TableColumnType.Text,
|
|
124
|
+
accessControl: {
|
|
125
|
+
read: [
|
|
126
|
+
Permission.ProjectOwner,
|
|
127
|
+
Permission.ProjectAdmin,
|
|
128
|
+
Permission.ReadAuditLog,
|
|
129
|
+
],
|
|
130
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
131
|
+
update: [],
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const userEmailColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
136
|
+
key: "userEmail",
|
|
137
|
+
title: "User Email",
|
|
138
|
+
description: "Email of the user at the time of the action.",
|
|
139
|
+
required: false,
|
|
140
|
+
type: TableColumnType.Text,
|
|
141
|
+
accessControl: {
|
|
142
|
+
read: [
|
|
143
|
+
Permission.ProjectOwner,
|
|
144
|
+
Permission.ProjectAdmin,
|
|
145
|
+
Permission.ReadAuditLog,
|
|
146
|
+
],
|
|
147
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
148
|
+
update: [],
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const userTypeColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
153
|
+
key: "userType",
|
|
154
|
+
title: "User Type",
|
|
155
|
+
description:
|
|
156
|
+
"Type of actor: User, API, Automation, MasterAdmin, or System.",
|
|
157
|
+
required: false,
|
|
158
|
+
type: TableColumnType.Text,
|
|
159
|
+
accessControl: {
|
|
160
|
+
read: [
|
|
161
|
+
Permission.ProjectOwner,
|
|
162
|
+
Permission.ProjectAdmin,
|
|
163
|
+
Permission.ReadAuditLog,
|
|
164
|
+
],
|
|
165
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
166
|
+
update: [],
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const apiKeyIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
171
|
+
key: "apiKeyId",
|
|
172
|
+
title: "API Key ID",
|
|
173
|
+
description:
|
|
174
|
+
"ID of the API key used for this action, if performed via API.",
|
|
175
|
+
required: false,
|
|
176
|
+
type: TableColumnType.ObjectID,
|
|
177
|
+
accessControl: {
|
|
178
|
+
read: [
|
|
179
|
+
Permission.ProjectOwner,
|
|
180
|
+
Permission.ProjectAdmin,
|
|
181
|
+
Permission.ReadAuditLog,
|
|
182
|
+
],
|
|
183
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
184
|
+
update: [],
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const apiKeyNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
189
|
+
key: "apiKeyName",
|
|
190
|
+
title: "API Key Name",
|
|
191
|
+
description: "Display name of the API key at the time of the action.",
|
|
192
|
+
required: false,
|
|
193
|
+
type: TableColumnType.Text,
|
|
194
|
+
accessControl: {
|
|
195
|
+
read: [
|
|
196
|
+
Permission.ProjectOwner,
|
|
197
|
+
Permission.ProjectAdmin,
|
|
198
|
+
Permission.ReadAuditLog,
|
|
199
|
+
],
|
|
200
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
201
|
+
update: [],
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const changesColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
206
|
+
key: "changes",
|
|
207
|
+
title: "Changes",
|
|
208
|
+
description:
|
|
209
|
+
"Field-level changes for Update actions, or full snapshot for Create/Delete. Redacted fields are omitted.",
|
|
210
|
+
required: true,
|
|
211
|
+
defaultValue: [],
|
|
212
|
+
type: TableColumnType.JSONArray,
|
|
213
|
+
codec: { codec: "ZSTD", level: 3 },
|
|
214
|
+
accessControl: {
|
|
215
|
+
read: [
|
|
216
|
+
Permission.ProjectOwner,
|
|
217
|
+
Permission.ProjectAdmin,
|
|
218
|
+
Permission.ReadAuditLog,
|
|
219
|
+
],
|
|
220
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
221
|
+
update: [],
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const retentionDateColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
226
|
+
key: "retentionDate",
|
|
227
|
+
title: "Retention Date",
|
|
228
|
+
description:
|
|
229
|
+
"Date after which this row is eligible for TTL deletion, computed at ingest time as createdAt + project.auditLogsRetentionInDays.",
|
|
230
|
+
required: true,
|
|
231
|
+
type: TableColumnType.Date,
|
|
232
|
+
defaultValue: undefined,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
super({
|
|
236
|
+
tableName: AnalyticsTableName.AuditLog,
|
|
237
|
+
tableEngine: AnalyticsTableEngine.MergeTree,
|
|
238
|
+
singularName: "Audit Log",
|
|
239
|
+
pluralName: "Audit Logs",
|
|
240
|
+
accessControl: {
|
|
241
|
+
read: [
|
|
242
|
+
Permission.ProjectOwner,
|
|
243
|
+
Permission.ProjectAdmin,
|
|
244
|
+
Permission.ReadAuditLog,
|
|
245
|
+
],
|
|
246
|
+
create: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
247
|
+
update: [],
|
|
248
|
+
delete: [],
|
|
249
|
+
},
|
|
250
|
+
tableBillingAccessControl: {
|
|
251
|
+
create: PlanType.Enterprise,
|
|
252
|
+
read: PlanType.Enterprise,
|
|
253
|
+
update: PlanType.Enterprise,
|
|
254
|
+
delete: PlanType.Enterprise,
|
|
255
|
+
},
|
|
256
|
+
crudApiPath: new Route("/audit-log"),
|
|
257
|
+
tableColumns: [
|
|
258
|
+
projectIdColumn,
|
|
259
|
+
resourceTypeColumn,
|
|
260
|
+
resourceIdColumn,
|
|
261
|
+
resourceNameColumn,
|
|
262
|
+
actionColumn,
|
|
263
|
+
userIdColumn,
|
|
264
|
+
userNameColumn,
|
|
265
|
+
userEmailColumn,
|
|
266
|
+
userTypeColumn,
|
|
267
|
+
apiKeyIdColumn,
|
|
268
|
+
apiKeyNameColumn,
|
|
269
|
+
changesColumn,
|
|
270
|
+
retentionDateColumn,
|
|
271
|
+
],
|
|
272
|
+
projections: [],
|
|
273
|
+
sortKeys: ["projectId", "createdAt", "resourceType", "resourceId"],
|
|
274
|
+
primaryKeys: ["projectId", "createdAt"],
|
|
275
|
+
partitionKey: "sipHash64(projectId) % 16",
|
|
276
|
+
ttlExpression: "retentionDate DELETE",
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public get projectId(): ObjectID | undefined {
|
|
281
|
+
return this.getColumnValue("projectId") as ObjectID | undefined;
|
|
282
|
+
}
|
|
283
|
+
public set projectId(v: ObjectID | undefined) {
|
|
284
|
+
this.setColumnValue("projectId", v);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
public get resourceType(): string | undefined {
|
|
288
|
+
return this.getColumnValue("resourceType") as string | undefined;
|
|
289
|
+
}
|
|
290
|
+
public set resourceType(v: string | undefined) {
|
|
291
|
+
this.setColumnValue("resourceType", v);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
public get resourceId(): ObjectID | undefined {
|
|
295
|
+
return this.getColumnValue("resourceId") as ObjectID | undefined;
|
|
296
|
+
}
|
|
297
|
+
public set resourceId(v: ObjectID | undefined) {
|
|
298
|
+
this.setColumnValue("resourceId", v);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public get resourceName(): string | undefined {
|
|
302
|
+
return this.getColumnValue("resourceName") as string | undefined;
|
|
303
|
+
}
|
|
304
|
+
public set resourceName(v: string | undefined) {
|
|
305
|
+
this.setColumnValue("resourceName", v);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
public get action(): string | undefined {
|
|
309
|
+
return this.getColumnValue("action") as string | undefined;
|
|
310
|
+
}
|
|
311
|
+
public set action(v: string | undefined) {
|
|
312
|
+
this.setColumnValue("action", v);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
public get userId(): ObjectID | undefined {
|
|
316
|
+
return this.getColumnValue("userId") as ObjectID | undefined;
|
|
317
|
+
}
|
|
318
|
+
public set userId(v: ObjectID | undefined) {
|
|
319
|
+
this.setColumnValue("userId", v);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
public get userName(): string | undefined {
|
|
323
|
+
return this.getColumnValue("userName") as string | undefined;
|
|
324
|
+
}
|
|
325
|
+
public set userName(v: string | undefined) {
|
|
326
|
+
this.setColumnValue("userName", v);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
public get userEmail(): string | undefined {
|
|
330
|
+
return this.getColumnValue("userEmail") as string | undefined;
|
|
331
|
+
}
|
|
332
|
+
public set userEmail(v: string | undefined) {
|
|
333
|
+
this.setColumnValue("userEmail", v);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
public get userType(): string | undefined {
|
|
337
|
+
return this.getColumnValue("userType") as string | undefined;
|
|
338
|
+
}
|
|
339
|
+
public set userType(v: string | undefined) {
|
|
340
|
+
this.setColumnValue("userType", v);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
public get apiKeyId(): ObjectID | undefined {
|
|
344
|
+
return this.getColumnValue("apiKeyId") as ObjectID | undefined;
|
|
345
|
+
}
|
|
346
|
+
public set apiKeyId(v: ObjectID | undefined) {
|
|
347
|
+
this.setColumnValue("apiKeyId", v);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
public get apiKeyName(): string | undefined {
|
|
351
|
+
return this.getColumnValue("apiKeyName") as string | undefined;
|
|
352
|
+
}
|
|
353
|
+
public set apiKeyName(v: string | undefined) {
|
|
354
|
+
this.setColumnValue("apiKeyName", v);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
public get changes(): JSONArray | undefined {
|
|
358
|
+
return this.getColumnValue("changes") as JSONArray | undefined;
|
|
359
|
+
}
|
|
360
|
+
public set changes(v: JSONArray | undefined) {
|
|
361
|
+
this.setColumnValue("changes", v);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
public get retentionDate(): Date | undefined {
|
|
365
|
+
return this.getColumnValue("retentionDate") as Date | undefined;
|
|
366
|
+
}
|
|
367
|
+
public set retentionDate(v: Date | undefined) {
|
|
368
|
+
this.setColumnValue("retentionDate", v);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
@@ -18,6 +18,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
18
18
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
19
19
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
20
20
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
21
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
21
22
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
22
23
|
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
|
|
23
24
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
@@ -87,6 +88,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
|
|
|
87
88
|
update: true,
|
|
88
89
|
read: true,
|
|
89
90
|
})
|
|
91
|
+
@EnableAuditLog()
|
|
90
92
|
@TableMetadata({
|
|
91
93
|
tableName: "Alert",
|
|
92
94
|
singularName: "Alert",
|
|
@@ -9,6 +9,7 @@ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableB
|
|
|
9
9
|
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
10
10
|
import ColumnType from "../../Types/Database/ColumnType";
|
|
11
11
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
12
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
12
13
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
13
14
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
14
15
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
@@ -57,6 +58,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
57
58
|
Permission.EditProjectApiKey,
|
|
58
59
|
],
|
|
59
60
|
})
|
|
61
|
+
@EnableAuditLog()
|
|
60
62
|
@TableMetadata({
|
|
61
63
|
tableName: "ApiKey",
|
|
62
64
|
singularName: "API Key",
|
|
@@ -2,6 +2,7 @@ import EnableRealtimeEventsOn from "../../../Types/Realtime/EnableRealtimeEvents
|
|
|
2
2
|
import Route from "../../../Types/API/Route";
|
|
3
3
|
import { ColumnAccessControl } from "../../../Types/BaseDatabase/AccessControl";
|
|
4
4
|
import ColumnBillingAccessControl from "../../../Types/BaseDatabase/ColumnBillingAccessControl";
|
|
5
|
+
import EnableAuditLogOn from "../../../Types/BaseDatabase/EnableAuditLogOn";
|
|
5
6
|
import EnableWorkflowOn from "../../../Types/BaseDatabase/EnableWorkflowOn";
|
|
6
7
|
import ModelPermission from "../../../Types/BaseDatabase/ModelPermission";
|
|
7
8
|
import { PlanType } from "../../../Types/Billing/SubscriptionPlan";
|
|
@@ -121,6 +122,8 @@ export default class DatabaseBaseModel extends BaseEntity {
|
|
|
121
122
|
|
|
122
123
|
public enableWorkflowOn!: EnableWorkflowOn;
|
|
123
124
|
|
|
125
|
+
public enableAuditLogOn!: EnableAuditLogOn | undefined;
|
|
126
|
+
|
|
124
127
|
public enableDocumentation!: boolean;
|
|
125
128
|
public isMasterAdminApiDocs!: boolean;
|
|
126
129
|
|
|
@@ -19,6 +19,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
19
19
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
20
20
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
21
21
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
22
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
22
23
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
23
24
|
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
|
|
24
25
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
@@ -91,6 +92,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
|
|
|
91
92
|
update: true,
|
|
92
93
|
read: true,
|
|
93
94
|
})
|
|
95
|
+
@EnableAuditLog()
|
|
94
96
|
@TableMetadata({
|
|
95
97
|
tableName: "Incident",
|
|
96
98
|
singularName: "Incident",
|
|
@@ -405,6 +405,25 @@ export default class KubernetesResource extends BaseModel {
|
|
|
405
405
|
})
|
|
406
406
|
public spec?: JSONObject = undefined;
|
|
407
407
|
|
|
408
|
+
@ColumnAccessControl({
|
|
409
|
+
create: [],
|
|
410
|
+
read: READ_PERMISSIONS,
|
|
411
|
+
update: [],
|
|
412
|
+
})
|
|
413
|
+
@TableColumn({
|
|
414
|
+
required: false,
|
|
415
|
+
type: TableColumnType.Number,
|
|
416
|
+
canReadOnRelationQuery: true,
|
|
417
|
+
title: "Container Count",
|
|
418
|
+
description:
|
|
419
|
+
"For Pods: count of entries in spec.containers, cached so the overview page can SUM it without scanning JSONB. Null for non-Pod kinds.",
|
|
420
|
+
})
|
|
421
|
+
@Column({
|
|
422
|
+
nullable: true,
|
|
423
|
+
type: ColumnType.Number,
|
|
424
|
+
})
|
|
425
|
+
public containerCount?: number = undefined;
|
|
426
|
+
|
|
408
427
|
@ColumnAccessControl({
|
|
409
428
|
create: [],
|
|
410
429
|
read: READ_PERMISSIONS,
|
|
@@ -11,6 +11,7 @@ import ColumnLength from "../../Types/Database/ColumnLength";
|
|
|
11
11
|
import ColumnType from "../../Types/Database/ColumnType";
|
|
12
12
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
13
13
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
14
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
14
15
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
15
16
|
import ColorField from "../../Types/Database/ColorField";
|
|
16
17
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
@@ -64,6 +65,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
64
65
|
update: true,
|
|
65
66
|
read: true,
|
|
66
67
|
})
|
|
68
|
+
@EnableAuditLog()
|
|
67
69
|
@CrudApiEndpoint(new Route("/label"))
|
|
68
70
|
@SlugifyColumn("name", "slug")
|
|
69
71
|
@TableMetadata({
|
|
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
12
12
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
13
13
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
14
14
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
15
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
15
16
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
16
17
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
17
18
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
@@ -80,6 +81,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
|
|
|
80
81
|
update: true,
|
|
81
82
|
read: true,
|
|
82
83
|
})
|
|
84
|
+
@EnableAuditLog()
|
|
83
85
|
@CrudApiEndpoint(new Route("/monitor"))
|
|
84
86
|
@SlugifyColumn("name", "slug")
|
|
85
87
|
@Entity({
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
ManyToOne,
|
|
31
31
|
} from "typeorm";
|
|
32
32
|
import NotificationRuleWorkspaceChannel from "../../Types/Workspace/NotificationRules/NotificationRuleWorkspaceChannel";
|
|
33
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
33
34
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
34
35
|
|
|
35
36
|
@EnableDocumentation()
|
|
@@ -42,6 +43,7 @@ import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
|
42
43
|
update: true,
|
|
43
44
|
read: true,
|
|
44
45
|
})
|
|
46
|
+
@EnableAuditLog()
|
|
45
47
|
@TableAccessControl({
|
|
46
48
|
create: [
|
|
47
49
|
Permission.ProjectOwner,
|
|
@@ -2074,4 +2074,84 @@ export default class Project extends TenantModel {
|
|
|
2074
2074
|
})
|
|
2075
2075
|
public defaultMetricDownsamplingRetentionDays?: MetricDownsamplingRetentionDays =
|
|
2076
2076
|
undefined;
|
|
2077
|
+
|
|
2078
|
+
@ColumnAccessControl({
|
|
2079
|
+
create: [Permission.User],
|
|
2080
|
+
read: [
|
|
2081
|
+
Permission.ProjectOwner,
|
|
2082
|
+
Permission.ProjectAdmin,
|
|
2083
|
+
Permission.ProjectMember,
|
|
2084
|
+
Permission.Viewer,
|
|
2085
|
+
Permission.ReadProject,
|
|
2086
|
+
Permission.UnAuthorizedSsoUser,
|
|
2087
|
+
Permission.ProjectUser,
|
|
2088
|
+
Permission.ReadAllProjectResources,
|
|
2089
|
+
],
|
|
2090
|
+
update: [
|
|
2091
|
+
Permission.ProjectOwner,
|
|
2092
|
+
Permission.ProjectAdmin,
|
|
2093
|
+
Permission.EditProject,
|
|
2094
|
+
],
|
|
2095
|
+
})
|
|
2096
|
+
@TableColumn({
|
|
2097
|
+
required: true,
|
|
2098
|
+
type: TableColumnType.Boolean,
|
|
2099
|
+
isDefaultValueColumn: true,
|
|
2100
|
+
defaultValue: false,
|
|
2101
|
+
title: "Enable Audit Logs",
|
|
2102
|
+
description:
|
|
2103
|
+
"When enabled, changes to resources in this project are recorded as audit log entries.",
|
|
2104
|
+
})
|
|
2105
|
+
@Column({
|
|
2106
|
+
type: ColumnType.Boolean,
|
|
2107
|
+
nullable: false,
|
|
2108
|
+
unique: false,
|
|
2109
|
+
default: false,
|
|
2110
|
+
})
|
|
2111
|
+
@ColumnBillingAccessControl({
|
|
2112
|
+
read: PlanType.Free,
|
|
2113
|
+
update: PlanType.Enterprise,
|
|
2114
|
+
create: PlanType.Free,
|
|
2115
|
+
})
|
|
2116
|
+
public enableAuditLogs?: boolean = undefined;
|
|
2117
|
+
|
|
2118
|
+
@ColumnAccessControl({
|
|
2119
|
+
create: [Permission.User],
|
|
2120
|
+
read: [
|
|
2121
|
+
Permission.ProjectOwner,
|
|
2122
|
+
Permission.ProjectAdmin,
|
|
2123
|
+
Permission.ProjectMember,
|
|
2124
|
+
Permission.Viewer,
|
|
2125
|
+
Permission.ReadProject,
|
|
2126
|
+
Permission.UnAuthorizedSsoUser,
|
|
2127
|
+
Permission.ProjectUser,
|
|
2128
|
+
Permission.ReadAllProjectResources,
|
|
2129
|
+
],
|
|
2130
|
+
update: [
|
|
2131
|
+
Permission.ProjectOwner,
|
|
2132
|
+
Permission.ProjectAdmin,
|
|
2133
|
+
Permission.EditProject,
|
|
2134
|
+
],
|
|
2135
|
+
})
|
|
2136
|
+
@TableColumn({
|
|
2137
|
+
required: false,
|
|
2138
|
+
type: TableColumnType.Number,
|
|
2139
|
+
isDefaultValueColumn: true,
|
|
2140
|
+
defaultValue: 7,
|
|
2141
|
+
title: "Audit Log Retention (days)",
|
|
2142
|
+
description:
|
|
2143
|
+
"Number of days to retain audit log entries. Minimum 7, maximum 180.",
|
|
2144
|
+
})
|
|
2145
|
+
@Column({
|
|
2146
|
+
type: ColumnType.Number,
|
|
2147
|
+
nullable: false,
|
|
2148
|
+
unique: false,
|
|
2149
|
+
default: 7,
|
|
2150
|
+
})
|
|
2151
|
+
@ColumnBillingAccessControl({
|
|
2152
|
+
read: PlanType.Free,
|
|
2153
|
+
update: PlanType.Enterprise,
|
|
2154
|
+
create: PlanType.Free,
|
|
2155
|
+
})
|
|
2156
|
+
public auditLogsRetentionInDays?: number = undefined;
|
|
2077
2157
|
}
|
|
@@ -15,6 +15,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
15
15
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
16
16
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
17
17
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
18
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
18
19
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
19
20
|
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
|
|
20
21
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
@@ -87,6 +88,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
|
|
|
87
88
|
update: true,
|
|
88
89
|
read: true,
|
|
89
90
|
})
|
|
91
|
+
@EnableAuditLog()
|
|
90
92
|
@TableMetadata({
|
|
91
93
|
singularName: "Scheduled Maintenance Event",
|
|
92
94
|
pluralName: "Scheduled Maintenance Events",
|
|
@@ -18,6 +18,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
18
18
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
19
19
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
20
20
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
21
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
21
22
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
22
23
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
23
24
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
@@ -85,6 +86,7 @@ import UptimePrecision from "../../Types/StatusPage/UptimePrecision";
|
|
|
85
86
|
update: true,
|
|
86
87
|
read: true,
|
|
87
88
|
})
|
|
89
|
+
@EnableAuditLog()
|
|
88
90
|
@CrudApiEndpoint(new Route("/status-page"))
|
|
89
91
|
@SlugifyColumn("name", "slug")
|
|
90
92
|
@Entity({
|
|
@@ -11,6 +11,7 @@ import ColumnType from "../../Types/Database/ColumnType";
|
|
|
11
11
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
12
12
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
13
13
|
import EnableMCP from "../../Types/Database/EnableMCP";
|
|
14
|
+
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
|
|
14
15
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
15
16
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
16
17
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
@@ -72,6 +73,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
72
73
|
update: true,
|
|
73
74
|
read: true,
|
|
74
75
|
})
|
|
76
|
+
@EnableAuditLog()
|
|
75
77
|
@TableMetadata({
|
|
76
78
|
tableName: "Team",
|
|
77
79
|
singularName: "Team",
|
|
@@ -119,7 +119,7 @@ class UserTelegram extends BaseModel {
|
|
|
119
119
|
required: false,
|
|
120
120
|
unique: false,
|
|
121
121
|
type: TableColumnType.ShortText,
|
|
122
|
-
canReadOnRelationQuery:
|
|
122
|
+
canReadOnRelationQuery: true,
|
|
123
123
|
description:
|
|
124
124
|
"Telegram chat ID captured from the OneUptime bot after verification. Populated automatically.",
|
|
125
125
|
})
|
|
@@ -122,6 +122,8 @@ export default class KubernetesResourceAPI extends BaseAPI<
|
|
|
122
122
|
hpaCount: summary.countsByKind["HorizontalPodAutoscaler"] || 0,
|
|
123
123
|
vpaCount: summary.countsByKind["VerticalPodAutoscaler"] || 0,
|
|
124
124
|
containerCount: summary.containerCount,
|
|
125
|
+
degradedPods: summary.degradedPods as unknown as JSONObject,
|
|
126
|
+
degradedNodes: summary.degradedNodes as unknown as JSONObject,
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
return Response.sendJsonObjectResponse(req, res, responseBody);
|