Files
studio-admin-be/src/agents/agents.controller.ts
T
chyoo f4a748b5f3
ci/woodpecker/push/woodpecker Pipeline was successful
improve runtime environment variable modal usability
2026-07-14 15:08:50 +09:00

64 lines
1.7 KiB
TypeScript

import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';
import {
ListLauncherSshKeysQuery,
CreateDeviceAuthorizationDto,
ListDeviceAuthorizationUsersQuery,
ListProvisionedDevicesQuery,
UpdateProvisionedDeviceDto,
} from './dto';
import { AgentsService } from './agents.service';
@Controller('agents')
export class AgentsController {
constructor(private readonly agentsService: AgentsService) {}
@Get('devices')
listDevices(@Query() query: ListProvisionedDevicesQuery) {
return this.agentsService.listDevices(query);
}
@Get('devices/:id')
getDevice(@Param('id') id: string) {
return this.agentsService.getDevice(id);
}
@Patch('devices/:id')
updateDevice(
@Param('id') id: string,
@Body() body: UpdateProvisionedDeviceDto,
) {
return this.agentsService.updateDevice(id, body);
}
@Get('ssh-keys')
listSshKeys(@Query() query: ListLauncherSshKeysQuery) {
return this.agentsService.listSshKeys(query);
}
@Delete('ssh-keys/:id')
removeSshKey(@Param('id') id: string) {
return this.agentsService.removeSshKey(id);
}
@Get('registration-users')
listRegistrationUsers(@Query() query: ListDeviceAuthorizationUsersQuery) {
return this.agentsService.listRegistrationUsers(query);
}
@Get('device-authorizations')
listDeviceAuthorizations() {
return this.agentsService.listDeviceAuthorizations();
}
@Post('device-authorizations')
createDeviceAuthorization(@Body() body: CreateDeviceAuthorizationDto) {
return this.agentsService.createDeviceAuthorization(body.userId);
}
@Post('device-authorizations/:id/cancel')
cancelDeviceAuthorization(@Param('id') id: string) {
return this.agentsService.cancelDeviceAuthorization(id);
}
}