You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.3 KiB
PHP
92 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Services\Cloud\CloudAccess;
|
|
use App\Services\Cloud\CloudAdminOperationRecoveryService;
|
|
use App\Services\Cloud\CloudAdminOperationsService;
|
|
use App\Services\Cloud\CloudInput;
|
|
|
|
/** Operations inventory and explicit administrator recovery controls. */
|
|
final class CloudAdminOperationsController
|
|
{
|
|
public function index($request, $response)
|
|
{
|
|
return $response->withJson(CloudAdminOperationsService::page(
|
|
$request->getAttribute('cloud_actor') ?? CloudAccess::actor(false),
|
|
$request->getQueryParams()
|
|
))->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function detail($request, $response, $args)
|
|
{
|
|
return $response->withJson(CloudAdminOperationsService::detail(
|
|
$request->getAttribute('cloud_actor') ?? CloudAccess::actor(false),
|
|
(string) ($args['id'] ?? '')
|
|
))->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function stopAuto($request, $response, $args)
|
|
{
|
|
return $response->withJson(CloudAdminOperationsService::stopAutoReconcile(
|
|
$request->getAttribute('cloud_actor') ?? CloudAccess::actor(false),
|
|
(string) ($args['id'] ?? '')
|
|
))->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function inspect($request, $response, $args)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
CloudInput::only(CloudInput::object($request), []);
|
|
$id = (string) ($args['id'] ?? '');
|
|
$inspection = CloudAdminOperationRecoveryService::inspect(
|
|
$actor, $id
|
|
);
|
|
return $response->withJson(
|
|
CloudAdminOperationsService::detail($actor, $id)
|
|
+ ['inspection' => $inspection]
|
|
)->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function abortJob($request, $response, $args)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
$id = (string) ($args['id'] ?? '');
|
|
$inspection = CloudAdminOperationRecoveryService::abortJob(
|
|
$actor, $id, CloudInput::object($request)
|
|
);
|
|
return $response->withJson(
|
|
CloudAdminOperationsService::detail($actor, $id)
|
|
+ ['inspection' => $inspection]
|
|
)->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function cleanup($request, $response, $args)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
$id = (string) ($args['id'] ?? '');
|
|
$inspection = CloudAdminOperationRecoveryService::cleanup(
|
|
$actor, $id, CloudInput::object($request)
|
|
);
|
|
return $response->withJson(
|
|
CloudAdminOperationsService::detail($actor, $id)
|
|
+ ['inspection' => $inspection]
|
|
)->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function forceDelete($request, $response, $args)
|
|
{
|
|
return $response->withJson(
|
|
CloudAdminOperationRecoveryService::forceDelete(
|
|
$request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false),
|
|
(string) ($args['id'] ?? ''),
|
|
CloudInput::object($request)
|
|
)
|
|
)->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
}
|