misc_pterodactyl-panel/routes/api-application.php

215 lines
9 KiB
PHP
Raw Normal View History

<?php
2017-11-19 22:30:00 +00:00
2020-04-13 00:20:09 +00:00
use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Controllers\Api\Application;
2020-04-13 00:20:09 +00:00
2022-12-15 00:05:46 +00:00
Route::get('/version', [Application\VersionController::class]);
2017-10-07 23:08:43 +00:00
/*
2017-11-19 22:30:00 +00:00
|--------------------------------------------------------------------------
2022-12-15 00:05:46 +00:00
| Database Controller Routes
2017-11-19 22:30:00 +00:00
|--------------------------------------------------------------------------
|
2022-12-15 00:05:46 +00:00
| Endpoint: /api/application/databases
2017-11-19 22:30:00 +00:00
|
*/
2022-12-15 00:05:46 +00:00
Route::group(['prefix' => '/databases'], function () {
Route::get('/', [Application\Databases\DatabaseController::class, 'index']);
Route::get('/{databaseHost}', [Application\Databases\DatabaseController::class, 'view']);
2020-04-13 00:20:09 +00:00
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Databases\DatabaseController::class, 'store']);
2017-11-19 22:30:00 +00:00
2022-12-15 00:05:46 +00:00
Route::patch('/{databaseHost}', [Application\Databases\DatabaseController::class, 'update']);
2017-11-19 22:30:00 +00:00
2022-12-15 00:05:46 +00:00
Route::delete('/{databaseHost}', [Application\Databases\DatabaseController::class, 'delete']);
});
/*
|--------------------------------------------------------------------------
| Egg Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/eggs
|
*/
Route::group(['prefix' => '/eggs'], function () {
Route::get('/{egg}', [Application\Eggs\EggController::class, 'view']);
Route::get('/{egg}/export', [Application\Eggs\EggController::class, 'export']);
Route::post('/', [Application\Eggs\EggController::class, 'store']);
Route::post('/{egg}/variables', [Application\Eggs\EggVariableController::class, 'store']);
Route::patch('/{egg}', [Application\Eggs\EggController::class, 'update']);
Route::patch('/{egg}/variables', [Application\Eggs\EggVariableController::class, 'update']);
Route::delete('/{egg}', [Application\Eggs\EggController::class, 'delete']);
Route::delete('/{egg}/variables/{eggVariable}', [Application\Eggs\EggVariableController::class, 'delete']);
});
/*
|--------------------------------------------------------------------------
| Location Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/locations
|
*/
Route::group(['prefix' => '/locations'], function () {
Route::get('/', [Application\Locations\LocationController::class, 'index']);
Route::get('/{location}', [Application\Locations\LocationController::class, 'view']);
Route::post('/', [Application\Locations\LocationController::class, 'store']);
Route::patch('/{location}', [Application\Locations\LocationController::class, 'update']);
Route::delete('/{location}', [Application\Locations\LocationController::class, 'delete']);
});
/*
|--------------------------------------------------------------------------
| Mount Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/mounts
|
*/
Route::group(['prefix' => '/mounts'], function () {
Route::get('/', [Application\Mounts\MountController::class, 'index']);
Route::get('/{mount}', [Application\Mounts\MountController::class, 'view']);
Route::post('/', [Application\Mounts\MountController::class, 'store']);
Route::put('/{mount}/eggs', [Application\Mounts\MountController::class, 'addEggs']);
Route::put('/{mount}/nodes', [Application\Mounts\MountController::class, 'addNodes']);
Route::patch('/{mount}', [Application\Mounts\MountController::class, 'update']);
Route::delete('/{mount}', [Application\Mounts\MountController::class, 'delete']);
Route::delete('/{mount}/eggs', [Application\Mounts\MountController::class, 'deleteEggs']);
Route::delete('/{mount}/nodes', [Application\Mounts\MountController::class, 'deleteNodes']);
});
/*
|--------------------------------------------------------------------------
| Nest Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/nests
|
*/
Route::group(['prefix' => '/nests'], function () {
Route::get('/', [Application\Nests\NestController::class, 'index']);
Route::get('/{nest}', [Application\Nests\NestController::class, 'view']);
Route::get('/{nest}/eggs', [Application\Eggs\EggController::class, 'index']);
Route::post('/', [Application\Nests\NestController::class, 'store']);
Route::post('/{nest}/import', [Application\Nests\NestController::class, 'import']);
Route::patch('/{nest}', [Application\Nests\NestController::class, 'update']);
Route::delete('/{nest}', [Application\Nests\NestController::class, 'delete']);
2017-11-19 22:30:00 +00:00
});
/*
|--------------------------------------------------------------------------
| Node Controller Routes
|--------------------------------------------------------------------------
|
2018-01-20 01:58:57 +00:00
| Endpoint: /api/application/nodes
|
*/
Route::group(['prefix' => '/nodes'], function () {
2022-12-15 00:05:46 +00:00
Route::get('/', [Application\Nodes\NodeController::class, 'index']);
Route::get('/deployable', [Application\Nodes\NodeDeploymentController::class, '__invoke']);
Route::get('/{node}', [Application\Nodes\NodeController::class, 'view']);
Route::get('/{node}/configuration', [Application\Nodes\NodeConfigurationController::class, '__invoke']);
Route::get('/{node}/information', [Application\Nodes\NodeInformationController::class, '__invoke']);
Route::post('/', [Application\Nodes\NodeController::class, 'store']);
2022-12-15 00:05:46 +00:00
Route::patch('/{node}', [Application\Nodes\NodeController::class, 'update']);
Route::delete('/{node}', [Application\Nodes\NodeController::class, 'delete']);
2022-12-15 00:05:46 +00:00
Route::group(['prefix' => '/{node}/allocations'], function () {
Route::get('/', [Application\Nodes\AllocationController::class, 'index']);
Route::post('/', [Application\Nodes\AllocationController::class, 'store']);
2022-12-15 00:05:46 +00:00
Route::delete('/{allocation}', [Application\Nodes\AllocationController::class, 'delete']);
});
});
2018-01-04 03:14:53 +00:00
/*
|--------------------------------------------------------------------------
2022-12-15 00:05:46 +00:00
| Role Controller Routes
2018-01-04 03:14:53 +00:00
|--------------------------------------------------------------------------
|
2022-12-15 00:05:46 +00:00
| Endpoint: /api/application/roles
2018-01-04 03:14:53 +00:00
|
*/
2022-12-15 00:05:46 +00:00
Route::group(['prefix' => '/roles'], function () {
Route::get('/', [Application\Roles\RoleController::class, 'index']);
Route::get('/{role}', [Application\Roles\RoleController::class, 'view']);
2018-01-04 03:14:53 +00:00
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Roles\RoleController::class, 'store']);
2018-01-04 03:14:53 +00:00
2022-12-15 00:05:46 +00:00
Route::patch('/{role}', [Application\Roles\RoleController::class, 'update']);
Route::delete('/{role}', [Application\Roles\RoleController::class, 'delete']);
});
/*
|--------------------------------------------------------------------------
2018-01-20 03:48:26 +00:00
| Server Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/servers
|
*/
Route::group(['prefix' => '/servers'], function () {
2022-12-15 00:05:46 +00:00
Route::get('/', [Application\Servers\ServerController::class, 'index']);
Route::get('/{server}', [Application\Servers\ServerController::class, 'view']);
Route::get('/external/{external_id}', [Application\Servers\ExternalServerController::class, 'index']);
2018-01-20 19:48:02 +00:00
2022-12-15 00:05:46 +00:00
Route::patch('/{server}', [Application\Servers\ServerController::class, 'update']);
Route::patch('/{server}/startup', [Application\Servers\StartupController::class, 'index']);
Route::post('/', [Application\Servers\ServerController::class, 'store']);
2022-12-15 00:05:46 +00:00
Route::post('/{server}/suspend', [Application\Servers\ServerManagementController::class, 'suspend']);
Route::post('/{server}/unsuspend', [Application\Servers\ServerManagementController::class, 'unsuspend']);
Route::post('/{server}/reinstall', [Application\Servers\ServerManagementController::class, 'reinstall']);
2018-01-20 19:48:02 +00:00
2022-12-15 00:05:46 +00:00
Route::delete('/{server}', [Application\Servers\ServerController::class, 'delete']);
Route::delete('/{server}/{force?}', [Application\Servers\ServerController::class, 'delete']);
// Database Management Endpoint
2022-12-15 00:05:46 +00:00
Route::group(['prefix' => '/{server}/databases'], function () {
Route::get('/', [Application\Servers\DatabaseController::class, 'index']);
Route::get('/{database}', [Application\Servers\DatabaseController::class, 'view']);
Route::post('/', [Application\Servers\DatabaseController::class, 'store']);
2022-12-15 00:05:46 +00:00
Route::post('/{database}/reset-password', [Application\Servers\DatabaseController::class, 'resetPassword']);
2022-12-15 00:05:46 +00:00
Route::delete('/{database}', [Application\Servers\DatabaseController::class, 'delete']);
});
2018-01-04 03:14:53 +00:00
});
/*
|--------------------------------------------------------------------------
2022-12-15 00:05:46 +00:00
| User Controller Routes
|--------------------------------------------------------------------------
|
2022-12-15 00:05:46 +00:00
| Endpoint: /api/application/users
|
*/
2022-12-15 00:05:46 +00:00
Route::group(['prefix' => '/users'], function () {
Route::get('/', [Application\Users\UserController::class, 'index']);
Route::get('/{user}', [Application\Users\UserController::class, 'view']);
Route::get('/external/{external_id}', [Application\Users\ExternalUserController::class, 'index']);
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Users\UserController::class, 'store']);
Route::patch('/{user}', [Application\Users\UserController::class, 'update']);
Route::delete('/{user}', [Application\Users\UserController::class, 'delete']);
});