[ [ 'code' => 'DisplayException', 'status' => '400', 'detail' => 'This server cannot be transferred to the selected node because the node does not have enough resources.', ], ], ]; /** * Start server transfer. */ #[Endpoint('Transfer server', 'Starts a server transfer to another node using the specified target allocations.')] #[BodyParam('node_id', 'integer', 'The destination node ID.', required: true, example: 2)] #[BodyParam('allocation_id', 'integer', 'The primary allocation ID on the destination node.', required: true, example: 10)] #[BodyParam('allocation_additional', 'integer[]', 'Additional allocation IDs on the destination node.', required: false, example: [11, 12])] #[ScribeResponse(status: 204, description: 'Server transfer started.')] #[ScribeResponse(self::TRANSFER_NOT_VIABLE_ERROR, status: 400, description: 'The destination node cannot fit the server or the server cannot currently be transferred.')] public function __invoke(TransferServerRequest $request, InitiatesTransfers $transfers, Server $server): Response { $data = $request->payload(); $node = Node::query()->findOrFail($data['node_id']); $transfers->initiate($server, $node, $data['allocation_id'], $data['allocation_additional']); Activity::event('admin:server.transfer') ->subject($server) ->property('name', $server->name) ->property('node_id', $node->id) ->log(); return $this->returnNoContent(); } }