misc_pterodactyl-panel/routes/api-application.php

215 lines
9.1 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
Route::get('/version', [Application\VersionController::class, '__invoke']);
2022-12-15 00:05:46 +00:00
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:id}', [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
Route::patch('/{databaseHost:id}', [Application\Databases\DatabaseController::class, 'update']);
2017-11-19 22:30:00 +00:00
Route::delete('/{databaseHost:id}', [Application\Databases\DatabaseController::class, 'delete']);
2022-12-15 00:05:46 +00:00
});
/*
|--------------------------------------------------------------------------
| Egg Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/eggs
|
*/
Route::group(['prefix' => '/eggs'], function () {
Route::get('/{egg:id}', [Application\Eggs\EggController::class, 'view']);
Route::get('/{egg:id}/export', [Application\Eggs\EggController::class, 'export']);
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Eggs\EggController::class, 'store']);
Route::post('/{egg:id}/variables', [Application\Eggs\EggVariableController::class, 'store']);
2022-12-15 00:05:46 +00:00
Route::patch('/{egg:id}', [Application\Eggs\EggController::class, 'update']);
Route::patch('/{egg:id}/variables', [Application\Eggs\EggVariableController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{egg:id}', [Application\Eggs\EggController::class, 'delete']);
Route::delete('/{egg:id}/variables/{eggVariable:id}', [Application\Eggs\EggVariableController::class, 'delete']);
2022-12-15 00:05:46 +00:00
});
/*
|--------------------------------------------------------------------------
| Location Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/locations
|
*/
Route::group(['prefix' => '/locations'], function () {
Route::get('/', [Application\Locations\LocationController::class, 'index']);
Route::get('/{location:id}', [Application\Locations\LocationController::class, 'view']);
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Locations\LocationController::class, 'store']);
Route::patch('/{location:id}', [Application\Locations\LocationController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{location:id}', [Application\Locations\LocationController::class, 'delete']);
2022-12-15 00:05:46 +00:00
});
/*
|--------------------------------------------------------------------------
| Mount Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/mounts
|
*/
Route::group(['prefix' => '/mounts'], function () {
Route::get('/', [Application\Mounts\MountController::class, 'index']);
Route::get('/{mount:id}', [Application\Mounts\MountController::class, 'view']);
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Mounts\MountController::class, 'store']);
Route::put('/{mount:id}/eggs', [Application\Mounts\MountController::class, 'addEggs']);
Route::put('/{mount:id}/nodes', [Application\Mounts\MountController::class, 'addNodes']);
2022-12-15 00:05:46 +00:00
Route::patch('/{mount:id}', [Application\Mounts\MountController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{mount:id}', [Application\Mounts\MountController::class, 'delete']);
Route::delete('/{mount:id}/eggs', [Application\Mounts\MountController::class, 'deleteEggs']);
Route::delete('/{mount:id}/nodes', [Application\Mounts\MountController::class, 'deleteNodes']);
2022-12-15 00:05:46 +00:00
});
/*
|--------------------------------------------------------------------------
| Nest Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/nests
|
*/
Route::group(['prefix' => '/nests'], function () {
Route::get('/', [Application\Nests\NestController::class, 'index']);
Route::get('/{nest:id}', [Application\Nests\NestController::class, 'view']);
Route::get('/{nest:id}/eggs', [Application\Eggs\EggController::class, 'index']);
2022-12-15 00:05:46 +00:00
Route::post('/', [Application\Nests\NestController::class, 'store']);
Route::post('/{nest:id}/import', [Application\Nests\NestController::class, 'import']);
2022-12-15 00:05:46 +00:00
Route::patch('/{nest:id}', [Application\Nests\NestController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{nest:id}', [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:id}', [Application\Nodes\NodeController::class, 'view']);
Route::get('/{node:id}/configuration', [Application\Nodes\NodeConfigurationController::class, '__invoke']);
Route::get('/{node:id}/information', [Application\Nodes\NodeInformationController::class, '__invoke']);
Route::post('/', [Application\Nodes\NodeController::class, 'store']);
Route::patch('/{node:id}', [Application\Nodes\NodeController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{node:id}', [Application\Nodes\NodeController::class, 'delete']);
Route::group(['prefix' => '/{node:id}/allocations'], function () {
2022-12-15 00:05:46 +00:00
Route::get('/', [Application\Nodes\AllocationController::class, 'index']);
Route::post('/', [Application\Nodes\AllocationController::class, 'store']);
Route::delete('/{allocation:id}', [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:id}', [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
Route::patch('/{role:id}', [Application\Roles\RoleController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{role:id}', [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:id}', [Application\Servers\ServerController::class, 'view']);
2022-12-15 00:05:46 +00:00
Route::get('/external/{external_id}', [Application\Servers\ExternalServerController::class, 'index']);
2018-01-20 19:48:02 +00:00
Route::patch('/{server:id}', [Application\Servers\ServerController::class, 'update']);
Route::patch('/{server:id}/startup', [Application\Servers\StartupController::class, 'index']);
Route::post('/', [Application\Servers\ServerController::class, 'store']);
Route::post('/{server:id}/suspend', [Application\Servers\ServerManagementController::class, 'suspend']);
Route::post('/{server:id}/unsuspend', [Application\Servers\ServerManagementController::class, 'unsuspend']);
Route::post('/{server:id}/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:id}/{force?}', [Application\Servers\ServerController::class, 'delete']);
// Database Management Endpoint
Route::group(['prefix' => '/{server:id}/databases'], function () {
2022-12-15 00:05:46 +00:00
Route::get('/', [Application\Servers\DatabaseController::class, 'index']);
Route::get('/{database:id}', [Application\Servers\DatabaseController::class, 'view']);
Route::post('/', [Application\Servers\DatabaseController::class, 'store']);
Route::post('/{database:id}/reset-password', [Application\Servers\DatabaseController::class, 'resetPassword']);
Route::delete('/{database:id}', [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:id}', [Application\Users\UserController::class, 'view']);
2022-12-15 00:05:46 +00:00
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:id}', [Application\Users\UserController::class, 'update']);
2022-12-15 00:05:46 +00:00
Route::delete('/{user:id}', [Application\Users\UserController::class, 'delete']);
});