Files
panel-pelican-dev/app/Http/Controllers/Admin/NodeAutoDeployController.php

33 lines
816 B
PHP
Raw Normal View History

2020-04-12 17:20:09 -07:00
<?php
2024-03-12 22:39:16 -04:00
namespace App\Http\Controllers\Admin;
2020-04-12 17:20:09 -07:00
2024-03-12 22:39:16 -04:00
use App\Models\Node;
use App\Http\Controllers\Controller;
use App\Services\Nodes\NodeAutoDeployService;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
2020-04-12 17:20:09 -07:00
class NodeAutoDeployController extends Controller
{
/**
* NodeAutoDeployController constructor.
*/
public function __construct(
private readonly NodeAutoDeployService $nodeAutoDeployService
2020-04-12 17:20:09 -07:00
) {
}
/**
* Handles the API request and returns the deployment command.
2020-04-12 17:20:09 -07:00
*
2024-03-12 22:39:16 -04:00
* @throws \App\Exceptions\Model\DataValidationException
2020-04-12 17:20:09 -07:00
*/
public function __invoke(Request $request, Node $node): JsonResponse
2020-04-12 17:20:09 -07:00
{
$command = $this->nodeAutoDeployService->handle($request, $node);
2020-04-12 17:20:09 -07:00
return new JsonResponse(['command' => $command]);
2020-04-12 17:20:09 -07:00
}
}