1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-23 01:22:30 +01:00
Pterodactyl-Panel/routes/api-application.php

109 lines
4.0 KiB
PHP
Raw Normal View History

<?php
2017-11-19 23:30:00 +01:00
use Pterodactyl\Models\Node;
use Pterodactyl\Models\User;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Location;
use Pterodactyl\Models\Allocation;
2017-10-08 01:08:43 +02:00
/*
2017-11-19 23:30:00 +01:00
|--------------------------------------------------------------------------
| User Controller Routes
|--------------------------------------------------------------------------
|
2018-01-20 02:58:57 +01:00
| Endpoint: /api/application/users
2017-11-19 23:30:00 +01:00
|
*/
Route::group(['prefix' => '/users'], function () {
Route::bind('user', function ($value) {
return User::find($value) ?? new User;
});
Route::get('/', 'Users\UserController@index')->name('api.application.users');
Route::get('/{user}', 'Users\UserController@view')->name('api.applications.users.view');
2017-11-19 23:30:00 +01:00
Route::post('/', 'Users\UserController@store');
Route::patch('/{user}', 'Users\UserController@update');
2017-11-19 23:30:00 +01:00
Route::delete('/{user}', 'Users\UserController@delete');
2017-11-19 23:30:00 +01:00
});
/*
|--------------------------------------------------------------------------
| Node Controller Routes
|--------------------------------------------------------------------------
|
2018-01-20 02:58:57 +01:00
| Endpoint: /api/application/nodes
|
*/
Route::group(['prefix' => '/nodes'], function () {
Route::bind('node', function ($value) {
return Node::find($value) ?? new Node;
});
Route::get('/', 'Nodes\NodeController@index')->name('api.application.nodes');
Route::get('/{node}', 'Nodes\NodeController@view')->name('api.application.nodes.view');
Route::post('/', 'Nodes\NodeController@store');
Route::patch('/{node}', 'Nodes\NodeController@update');
Route::delete('/{node}', 'Nodes\NodeController@delete');
Route::group(['prefix' => '/{node}/allocations'], function () {
Route::bind('allocation', function ($value) {
return Allocation::find($value) ?? new Allocation;
});
Route::get('/', 'Nodes\AllocationController@index')->name('api.application.allocations');
Route::delete('/{allocation}', 'Nodes\AllocationController@delete')->name('api.application.allocations.view');
});
});
2018-01-04 04:14:53 +01:00
/*
|--------------------------------------------------------------------------
| Location Controller Routes
|--------------------------------------------------------------------------
|
2018-01-20 02:58:57 +01:00
| Endpoint: /api/application/locations
2018-01-04 04:14:53 +01:00
|
*/
Route::group(['prefix' => '/locations'], function () {
Route::bind('location', function ($value) {
return Location::find($value) ?? new Location;
});
Route::get('/', 'Locations\LocationController@index')->name('api.applications.locations');
Route::get('/{location}', 'Locations\LocationController@view')->name('api.application.locations.view');
2018-01-04 04:14:53 +01:00
Route::post('/', 'Locations\LocationController@store');
Route::patch('/{location}', 'Locations\LocationController@update');
2018-01-04 04:14:53 +01:00
Route::delete('/{location}', 'Locations\LocationController@delete');
});
/*
|--------------------------------------------------------------------------
2018-01-20 04:48:26 +01:00
| Server Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /api/application/servers
|
*/
Route::group(['prefix' => '/servers'], function () {
2018-01-20 04:48:26 +01:00
Route::bind('server', function ($value) {
return Server::find($value) ?? new Server;
});
Route::get('/', 'Servers\ServerController@index')->name('api.application.servers');
2018-01-20 20:48:02 +01:00
Route::get('/{server}', 'Servers\ServerController@view')->name('api.application.servers.view');
Route::post('/{server}/suspend', 'Servers\ServerManagementController@suspend')->name('api.application.servers.suspend');
Route::post('/{server}/unsuspend', 'Servers\ServerManagementController@unsuspend')->name('api.application.servers.unsuspend');
Route::post('/{server}/reinstall', 'Servers\ServerManagementController@reinstall')->name('api.application.servers.reinstall');
Route::post('/{server}/rebuild', 'Servers\ServerManagementController@rebuild')->name('api.application.servers.rebuild');
Route::delete('/{server}', 'Servers\ServerController@delete');
Route::delete('/{server}/{force?}', 'Servers\ServerController@delete');
2018-01-04 04:14:53 +01:00
});