[ [ '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 { $validated = $request->safe(); $node = Node::query()->findOrFail($validated->integer('node_id')); $transfers->initiate($server, $node, $validated->integer('allocation_id'), $request->additionalAllocations()); Activity::event('admin:server.transfer') ->subject($server) ->property('name', $server->name) ->property('node_id', $node->id) ->log(); return $this->returnNoContent(); } }