2016-09-05 20:21:36 +00:00
|
|
|
<?php
|
2017-11-19 22:30:00 +00:00
|
|
|
|
2018-01-13 02:39:15 +00:00
|
|
|
use Pterodactyl\Models\Node;
|
2018-01-12 04:49:46 +00:00
|
|
|
use Pterodactyl\Models\User;
|
2018-01-20 03:47:06 +00:00
|
|
|
use Pterodactyl\Models\Server;
|
2018-01-13 02:39:15 +00:00
|
|
|
use Pterodactyl\Models\Location;
|
|
|
|
use Pterodactyl\Models\Allocation;
|
2018-01-12 04:49:46 +00:00
|
|
|
|
2017-10-07 23:08:43 +00:00
|
|
|
/*
|
2017-11-19 22:30:00 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| User Controller Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
2018-01-20 01:58:57 +00:00
|
|
|
| Endpoint: /api/application/users
|
2017-11-19 22:30:00 +00:00
|
|
|
|
|
|
|
|
*/
|
|
|
|
Route::group(['prefix' => '/users'], function () {
|
2018-01-12 04:49:46 +00:00
|
|
|
Route::bind('user', function ($value) {
|
|
|
|
return User::find($value) ?? new User;
|
|
|
|
});
|
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::get('/', 'Users\UserController@index')->name('api.application.users');
|
|
|
|
Route::get('/{user}', 'Users\UserController@view')->name('api.applications.users.view');
|
2017-11-19 22:30:00 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::post('/', 'Users\UserController@store');
|
|
|
|
Route::patch('/{user}', 'Users\UserController@update');
|
2017-11-19 22:30:00 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::delete('/{user}', 'Users\UserController@delete');
|
2017-11-19 22:30:00 +00:00
|
|
|
});
|
2017-12-17 20:57:05 +00:00
|
|
|
|
2018-01-01 21:11:44 +00:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Node Controller Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
2018-01-20 01:58:57 +00:00
|
|
|
| Endpoint: /api/application/nodes
|
2018-01-01 21:11:44 +00:00
|
|
|
|
|
|
|
|
*/
|
2017-12-17 20:57:05 +00:00
|
|
|
Route::group(['prefix' => '/nodes'], function () {
|
2018-01-13 02:39:15 +00:00
|
|
|
Route::bind('node', function ($value) {
|
|
|
|
return Node::find($value) ?? new Node;
|
|
|
|
});
|
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::get('/', 'Nodes\NodeController@index')->name('api.application.nodes');
|
|
|
|
Route::get('/{node}', 'Nodes\NodeController@view')->name('api.application.nodes.view');
|
2018-01-01 21:11:44 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::post('/', 'Nodes\NodeController@store');
|
|
|
|
Route::patch('/{node}', 'Nodes\NodeController@update');
|
2018-01-01 21:11:44 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::delete('/{node}', 'Nodes\NodeController@delete');
|
2018-01-11 05:19:03 +00:00
|
|
|
|
|
|
|
Route::group(['prefix' => '/{node}/allocations'], function () {
|
2018-01-13 02:39:15 +00:00
|
|
|
Route::bind('allocation', function ($value) {
|
|
|
|
return Allocation::find($value) ?? new Allocation;
|
|
|
|
});
|
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::get('/', 'Nodes\AllocationController@index')->name('api.application.allocations');
|
2018-01-11 05:19:03 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::delete('/{allocation}', 'Nodes\AllocationController@delete')->name('api.application.allocations.view');
|
2018-01-11 05:19:03 +00:00
|
|
|
});
|
2017-12-17 20:57:05 +00:00
|
|
|
});
|
2018-01-04 03:14:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Location Controller Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
2018-01-20 01:58:57 +00:00
|
|
|
| Endpoint: /api/application/locations
|
2018-01-04 03:14:53 +00:00
|
|
|
|
|
|
|
|
*/
|
|
|
|
Route::group(['prefix' => '/locations'], function () {
|
2018-01-13 02:39:15 +00:00
|
|
|
Route::bind('location', function ($value) {
|
|
|
|
return Location::find($value) ?? new Location;
|
|
|
|
});
|
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::get('/', 'Locations\LocationController@index')->name('api.applications.locations');
|
|
|
|
Route::get('/{location}', 'Locations\LocationController@view')->name('api.application.locations.view');
|
2018-01-04 03:14:53 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::post('/', 'Locations\LocationController@store');
|
|
|
|
Route::patch('/{location}', 'Locations\LocationController@update');
|
2018-01-04 03:14:53 +00:00
|
|
|
|
2018-01-20 03:47:06 +00:00
|
|
|
Route::delete('/{location}', 'Locations\LocationController@delete');
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
2018-01-20 03:48:26 +00:00
|
|
|
| Server Controller Routes
|
2018-01-20 03:47:06 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Endpoint: /api/application/servers
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
Route::group(['prefix' => '/servers'], function () {
|
2018-01-20 03:48:26 +00:00
|
|
|
Route::bind('server', function ($value) {
|
|
|
|
return Server::find($value) ?? new Server;
|
2018-01-20 03:47:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Route::get('/', 'Servers\ServerController@index')->name('api.application.servers');
|
2018-01-20 19:48:02 +00: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 03:14:53 +00:00
|
|
|
});
|