e313dff674
Changes the API internals to use normal Laravel binding which automatically supports nested-models and can determine their relationships. This removes a lot of confusingly complex internal logic and replaces it with standard Laravel code. This also removes a deprecated "getModel" method and fully replaces it with a "parameter" method that does stricter type-checking.
124 lines
6.4 KiB
PHP
124 lines
6.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Pterodactyl\Http\Controllers\Api\Application;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| User Controller Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Endpoint: /api/application/users
|
|
|
|
|
*/
|
|
|
|
Route::group(['prefix' => '/users'], function () {
|
|
Route::get('/', [Application\Users\UserController::class, 'index'])->name('api.application.users');
|
|
Route::get('/{user:id}', [Application\Users\UserController::class, 'view'])->name('api.application.users.view');
|
|
Route::get('/external/{external_id}', [Application\Users\ExternalUserController::class, 'index'])->name('api.application.users.external');
|
|
|
|
Route::post('/', [Application\Users\UserController::class, 'store']);
|
|
Route::patch('/{user:id}', [Application\Users\UserController::class, 'update']);
|
|
|
|
Route::delete('/{user:id}', [Application\Users\UserController::class, 'delete']);
|
|
});
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Node Controller Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Endpoint: /api/application/nodes
|
|
|
|
|
*/
|
|
Route::group(['prefix' => '/nodes'], function () {
|
|
Route::get('/', [Application\Nodes\NodeController::class, 'index'])->name('api.application.nodes');
|
|
Route::get('/deployable', Application\Nodes\NodeDeploymentController::class);
|
|
Route::get('/{node:id}', [Application\Nodes\NodeController::class, 'view'])->name('api.application.nodes.view');
|
|
Route::get('/{node:id}/configuration', Application\Nodes\NodeConfigurationController::class);
|
|
|
|
Route::post('/', [Application\Nodes\NodeController::class, 'store']);
|
|
Route::patch('/{node:id}', [Application\Nodes\NodeController::class, 'update']);
|
|
|
|
Route::delete('/{node:id}', [Application\Nodes\NodeController::class, 'delete']);
|
|
|
|
Route::group(['prefix' => '/{node:id}/allocations'], function () {
|
|
Route::get('/', [Application\Nodes\AllocationController::class, 'index'])->name('api.application.allocations');
|
|
Route::post('/', [Application\Nodes\AllocationController::class, 'store']);
|
|
Route::delete('/{allocation:id}', [Application\Nodes\AllocationController::class, 'delete'])->name('api.application.allocations.view');
|
|
});
|
|
});
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Location Controller Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Endpoint: /api/application/locations
|
|
|
|
|
*/
|
|
Route::group(['prefix' => '/locations'], function () {
|
|
Route::get('/', [Application\Locations\LocationController::class, 'index'])->name('api.applications.locations');
|
|
Route::get('/{location:id}', [Application\Locations\LocationController::class, 'view'])->name('api.application.locations.view');
|
|
|
|
Route::post('/', [Application\Locations\LocationController::class, 'store']);
|
|
Route::patch('/{location:id}', [Application\Locations\LocationController::class, 'update']);
|
|
|
|
Route::delete('/{location:id}', [Application\Locations\LocationController::class, 'delete']);
|
|
});
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Server Controller Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Endpoint: /api/application/servers
|
|
|
|
|
*/
|
|
Route::group(['prefix' => '/servers'], function () {
|
|
Route::get('/', [Application\Servers\ServerController::class, 'index'])->name('api.application.servers');
|
|
Route::get('/{server:id}', [Application\Servers\ServerController::class, 'view'])->name('api.application.servers.view');
|
|
Route::get('/external/{external_id}', [Application\Servers\ExternalServerController::class, 'index'])->name('api.application.servers.external');
|
|
|
|
Route::patch('/{server:id}/details', [Application\Servers\ServerDetailsController::class, 'details'])->name('api.application.servers.details');
|
|
Route::patch('/{server:id}/build', [Application\Servers\ServerDetailsController::class, 'build'])->name('api.application.servers.build');
|
|
Route::patch('/{server:id}/startup', [Application\Servers\StartupController::class, 'index'])->name('api.application.servers.startup');
|
|
|
|
Route::post('/', [Application\Servers\ServerController::class, 'store']);
|
|
Route::post('/{server:id}/suspend', [Application\Servers\ServerManagementController::class, 'suspend'])->name('api.application.servers.suspend');
|
|
Route::post('/{server:id}/unsuspend', [Application\Servers\ServerManagementController::class, 'unsuspend'])->name('api.application.servers.unsuspend');
|
|
Route::post('/{server:id}/reinstall', [Application\Servers\ServerManagementController::class, 'reinstall'])->name('api.application.servers.reinstall');
|
|
|
|
Route::delete('/{server:id}', [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 () {
|
|
Route::get('/', [Application\Servers\DatabaseController::class, 'index'])->name('api.application.servers.databases');
|
|
Route::get('/{database:id}', [Application\Servers\DatabaseController::class, 'view'])->name('api.application.servers.databases.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']);
|
|
});
|
|
});
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Nest Controller Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Endpoint: /api/application/nests
|
|
|
|
|
*/
|
|
Route::group(['prefix' => '/nests'], function () {
|
|
Route::get('/', [Application\Nests\NestController::class, 'index'])->name('api.application.nests');
|
|
Route::get('/{nest:id}', [Application\Nests\NestController::class, 'view'])->name('api.application.nests.view');
|
|
|
|
// Egg Management Endpoint
|
|
Route::group(['prefix' => '/{nest:id}/eggs'], function () {
|
|
Route::get('/', [Application\Nests\EggController::class, 'index'])->name('api.application.nests.eggs');
|
|
Route::get('/{egg:id}', [Application\Nests\EggController::class, 'view'])->name('api.application.nests.eggs.view');
|
|
});
|
|
});
|