getAttribute('cloud_actor') ?? CloudAccess::actor(); } private function json($response, array $value, int $status = 200) { return $response->withJson($value, $status) ->withHeader('Cache-Control', 'no-store'); } public function index($request, $response) { return $this->json($response, ['vpcs' => CloudVpcService::listing($this->actor($request))]); } public function show($request, $response, $args) { return $this->json($response, CloudVpcService::show( (string) $args['vpc_key'], $this->actor($request) )); } public function create($request, $response) { $value = CloudVpcService::create($this->actor($request), CloudInput::object($request)); return $this->json($response, $value, 202); } public function delete($request, $response, $args) { $value = CloudVpcService::delete((string) $args['vpc_key'], $this->actor($request), CloudInput::object($request)); return $this->json($response, $value, 202); } public function attachMember($request, $response, $args) { $value = CloudVpcService::attachMember((string) $args['vpc_key'], $this->actor($request), CloudInput::object($request)); return $this->json($response, $value, 202); } public function detachMember($request, $response, $args) { $value = CloudVpcService::detachMember((string) $args['vpc_key'], (string) $args['member_key'], $this->actor($request), CloudInput::object($request)); return $this->json($response, $value, 202); } public function routes($request, $response, $args) { return $this->json($response, CloudVpcService::replaceRoutes( (string) $args['vpc_key'], $this->actor($request), CloudInput::object($request) ), 202); } public function acl($request, $response, $args) { return $this->json($response, CloudVpcService::replaceAcl( (string) $args['vpc_key'], $this->actor($request), CloudInput::object($request) ), 202); } public function reconcile($request, $response, $args) { // Reconcile is a separate, explicit operation. It never creates or // claims a general VM-job/public-network row. It is also the // explicit retry path for a control-plane operation paused until the // later private data-plane readback phase. return $this->json($response, CloudVpcService::reconcile( (string) $args['vpc_key'], $this->actor($request), allowDeferredRetry: true, allowFailedRetry: true ), 200); } }