Add API endpoint for getting server resource utilization, closes #900

This endpoint is throttled to 15 requests per minute to avoid destroying the daemon since clients can use it.
This commit is contained in:
Dane Everitt 2018-03-17 14:01:53 -05:00
parent bac02f64e3
commit 3e2ac981a9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 115 additions and 0 deletions

View file

@ -22,6 +22,9 @@ Route::get('/', 'ClientController@index')->name('api.client.index');
*/
Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateClientAccess::class]], function () {
Route::get('/', 'Servers\ServerController@index')->name('api.client.servers.view');
Route::get('/utilization', 'Servers\ResourceUtilizationController@index')
->middleware(['throttle:15,1'])
->name('api.client.servers.resources');
Route::post('/command', 'Servers\CommandController@index')->name('api.client.servers.command');
Route::post('/power', 'Servers\PowerController@index')->name('api.client.servers.power');