apply requested changes
Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
@@ -95,6 +95,8 @@ The Catalog backend emits audit events for various operations. Events are groupe
|
||||
|
||||
- **`entity-fetch`**: Retrieves entities.
|
||||
|
||||
Filter on `queryType`.
|
||||
|
||||
- **`all`**: Fetching all entities. (GET `/entities`)
|
||||
- **`by-id`**: Fetching a single entity using its UID. (GET `/entities/by-uid/:uid`)
|
||||
- **`by-name`**: Fetching a single entity using its kind, namespace, and name. (GET `/entities/by-name/:kind/:namespace/:name`)
|
||||
@@ -104,6 +106,8 @@ The Catalog backend emits audit events for various operations. Events are groupe
|
||||
|
||||
- **`entity-mutate`**: Modifies entities.
|
||||
|
||||
Filter on `actionType`.
|
||||
|
||||
- **`delete`**: Deleting a single entity. Note: this will not be a permanent deletion and the entity will be restored if the parent location is still present in the catalog. (DELETE `/entities/by-uid/:uid`)
|
||||
- **`refresh`**: Scheduling an entity refresh. (POST `/entities/refresh`)
|
||||
|
||||
@@ -115,6 +119,8 @@ The Catalog backend emits audit events for various operations. Events are groupe
|
||||
|
||||
- **`location-fetch`**: Retrieves locations.
|
||||
|
||||
Filter on `actionType`.
|
||||
|
||||
- **`all`**: Fetching all locations. (GET `/locations`)
|
||||
- **`by-id`**: Fetching a single location by ID. (GET `/locations/:id`)
|
||||
- **`by-entity`**: Fetching locations associated with an entity ref. (GET `/locations/by-entity`)
|
||||
|
||||
@@ -35,7 +35,7 @@ import { LocationAnalyzer } from '@backstage/plugin-catalog-node';
|
||||
import express from 'express';
|
||||
import yn from 'yn';
|
||||
import { z } from 'zod';
|
||||
import { Cursor, EntitiesCatalog } from '../catalog/types';
|
||||
import { EntitiesCatalog } from '../catalog/types';
|
||||
import { CatalogProcessingOrchestrator } from '../processing/types';
|
||||
import { validateEntityEnvelope } from '../processing/util';
|
||||
import { createOpenApiRouter } from '../schema/openapi';
|
||||
@@ -50,11 +50,7 @@ import {
|
||||
import { parseEntityFacetParams } from './request/parseEntityFacetParams';
|
||||
import { parseEntityOrderParams } from './request/parseEntityOrderParams';
|
||||
import { parseEntityPaginationParams } from './request/parseEntityPaginationParams';
|
||||
import {
|
||||
createEntityArrayJsonStream,
|
||||
writeEntitiesResponse,
|
||||
writeSingleEntityResponse,
|
||||
} from './response';
|
||||
import { writeEntitiesResponse, writeSingleEntityResponse } from './response';
|
||||
import { LocationService, RefreshService } from './types';
|
||||
import {
|
||||
disallowReadonlyMode,
|
||||
@@ -129,9 +125,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-mutate',
|
||||
subEventId: 'refresh',
|
||||
severityLevel: 'medium',
|
||||
meta: {
|
||||
queryType: 'refresh',
|
||||
entityRef: restBody.entityRef,
|
||||
},
|
||||
request: req,
|
||||
@@ -165,8 +161,11 @@ export async function createRouter(
|
||||
.get('/entities', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'all',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'all',
|
||||
query: req.query,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -260,8 +259,10 @@ export async function createRouter(
|
||||
.get('/entities/by-query', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'by-query',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-query',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -311,9 +312,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'by-uid',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-uid',
|
||||
uid: uid,
|
||||
},
|
||||
});
|
||||
@@ -343,10 +344,10 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-mutate',
|
||||
subEventId: 'delete',
|
||||
severityLevel: 'medium',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'delete',
|
||||
uid: uid,
|
||||
},
|
||||
});
|
||||
@@ -372,9 +373,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'by-name',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-name',
|
||||
entityRef: entityRef,
|
||||
},
|
||||
});
|
||||
@@ -407,9 +408,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'ancestry',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'ancestry',
|
||||
entityRef: entityRef,
|
||||
},
|
||||
});
|
||||
@@ -443,8 +444,10 @@ export async function createRouter(
|
||||
.post('/entities/by-refs', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'entity-fetch',
|
||||
subEventId: 'by-refs',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-refs',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -510,10 +513,10 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'location-mutate',
|
||||
subEventId: 'create',
|
||||
severityLevel: dryRun ? 'low' : 'medium',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'create',
|
||||
location: location,
|
||||
isDryRun: dryRun,
|
||||
},
|
||||
@@ -555,8 +558,10 @@ export async function createRouter(
|
||||
.get('/locations', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'location-fetch',
|
||||
subEventId: 'all',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'all',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -580,9 +585,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'location-fetch',
|
||||
subEventId: 'by-id',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-id',
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
@@ -611,10 +616,10 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'location-mutate',
|
||||
subEventId: 'delete',
|
||||
severityLevel: 'medium',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'delete',
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
@@ -642,9 +647,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'location-fetch',
|
||||
subEventId: 'by-entity',
|
||||
request: req,
|
||||
meta: {
|
||||
queryType: 'by-entity',
|
||||
locationRef: locationRef,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -79,6 +79,9 @@ The Scaffolder backend emits audit events for various operations. Events are gro
|
||||
**Task Events:**
|
||||
|
||||
- **`task`**: Operations related to Scaffolder tasks.
|
||||
|
||||
Filter on `actionType`.
|
||||
|
||||
- **`create`**: Creates a new task. (POST `/v2/tasks`)
|
||||
- **`list`**: Fetches details of all tasks. (GET `/v2/tasks`)
|
||||
- **`get`**: Fetches details of a specific task. (GET `/v2/tasks/:taskId`)
|
||||
|
||||
@@ -207,9 +207,9 @@ export class TaskManager implements TaskContext {
|
||||
|
||||
const auditorEvent = await this.auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'execution',
|
||||
severityLevel: 'medium',
|
||||
meta: {
|
||||
actionType: 'execution',
|
||||
taskId: this.task.taskId,
|
||||
taskParameters: this.task.spec.parameters,
|
||||
},
|
||||
@@ -474,9 +474,9 @@ export class StorageTaskBroker implements TaskBroker {
|
||||
tasks.map(async task => {
|
||||
const auditorEvent = await this.auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'stale-cancel',
|
||||
severityLevel: 'medium',
|
||||
meta: {
|
||||
actionType: 'stale-cancel',
|
||||
taskId: task.taskId,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -176,9 +176,9 @@ export class TaskWorker {
|
||||
async runOneTask(task: TaskContext) {
|
||||
await this.auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'execution',
|
||||
severityLevel: 'medium',
|
||||
meta: {
|
||||
actionType: 'execution',
|
||||
taskId: task.taskId,
|
||||
taskParameters: task.spec.parameters,
|
||||
templateRef: task.spec.templateInfo?.entityRef,
|
||||
|
||||
@@ -542,10 +542,10 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'create',
|
||||
severityLevel: 'medium',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'create',
|
||||
templateRef: templateRef,
|
||||
},
|
||||
});
|
||||
@@ -648,8 +648,10 @@ export async function createRouter(
|
||||
.get('/v2/tasks', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'list',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'list',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -711,9 +713,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'get',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'get',
|
||||
taskId: taskId,
|
||||
},
|
||||
});
|
||||
@@ -746,10 +748,12 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'cancel',
|
||||
severityLevel: 'medium',
|
||||
request: req,
|
||||
meta: { taskId: taskId },
|
||||
meta: {
|
||||
actionType: 'cancel',
|
||||
taskId: taskId,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -776,10 +780,12 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'retry',
|
||||
severityLevel: 'medium',
|
||||
request: req,
|
||||
meta: { taskId: taskId },
|
||||
meta: {
|
||||
actionType: 'retry',
|
||||
taskId: taskId,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -805,9 +811,11 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'stream',
|
||||
request: req,
|
||||
meta: { taskId: taskId },
|
||||
meta: {
|
||||
actionType: 'stream',
|
||||
taskId: taskId,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -875,9 +883,9 @@ export async function createRouter(
|
||||
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'events',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'events',
|
||||
taskId: taskId,
|
||||
},
|
||||
});
|
||||
@@ -927,8 +935,10 @@ export async function createRouter(
|
||||
.post('/v2/dry-run', async (req, res) => {
|
||||
const auditorEvent = await auditor?.createEvent({
|
||||
eventId: 'task',
|
||||
subEventId: 'dry-run',
|
||||
request: req,
|
||||
meta: {
|
||||
actionType: 'dry-run',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user