Add device traffic reset with outbound baselines
This commit is contained in:
@@ -7,6 +7,7 @@ interface DeviceInventoryPort {
|
||||
snapshot(): unknown;
|
||||
refresh(): Promise<unknown>;
|
||||
update(deviceId: string, patch: Record<string, unknown>, expectedRevision: unknown): unknown;
|
||||
resetTraffic(expectedRevision: unknown): Promise<unknown>;
|
||||
setPolicy(deviceId: string, mode: unknown, expectedRevision: unknown): Promise<unknown>;
|
||||
}
|
||||
|
||||
@@ -39,6 +40,15 @@ export function createDeviceInventoryRoute(dependencies: DeviceInventoryRouteDep
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathname === '/api/devices/traffic') {
|
||||
if (!dependencies.deviceInventory || req.method !== 'DELETE') {
|
||||
throw new HarborError('ENDPOINT_NOT_FOUND');
|
||||
}
|
||||
const body = await dependencies.readBody(req);
|
||||
sendJson(res, 200, await dependencies.deviceInventory.resetTraffic(body.expectedRevision));
|
||||
return true;
|
||||
}
|
||||
|
||||
const deviceMatch = pathname.match(DEVICE_PATH);
|
||||
if (deviceMatch) {
|
||||
if (!dependencies.deviceInventory || req.method !== 'PUT') {
|
||||
|
||||
Reference in New Issue
Block a user