getAttribute('cloud_actor') ?? CloudAccess::actor(); if (!($actor['is_admin'] ?? false)) { throw new CloudError('需要管理员权限', 403); } if ($manage) { CloudAccess::manage($actor); } return $actor; } public function configuration($request, $response, $args) { $write = strtoupper((string) $request->getMethod()) !== 'GET'; $this->actor($request, $write); $hostId = (int) ($args['id'] ?? 0); if (!$write) { $result = CloudHostVpcTransportService::read($hostId); } else { $body = CloudInput::object($request); $result = CloudHostVpcTransportService::save($hostId, $body); } return $response->withJson($result) ->withHeader('Cache-Control', 'private, no-store'); } public function discover($request, $response, $args) { $actor = $this->actor($request, true); return $response->withJson(CloudHostVpcTransportService::discover( (int) ($args['id'] ?? 0), $actor ))->withHeader('Cache-Control', 'private, no-store'); } public function test($request, $response, $args) { $actor = $this->actor($request, true); return $response->withJson(CloudHostVpcTransportService::test( (int) ($args['id'] ?? 0), $actor ))->withHeader('Cache-Control', 'private, no-store'); } }