validator->validate($input); switch ($input->method){ case DeployMethodTypes::UNICAST: case DeployMethodTypes::UNICAST_DIRECT: foreach ($input->clients as $client) { $inputData = [ 'method' => $input->method, 'client' => $client->getEntity()->getUuid(), 'image' => $image->getUuid(), 'imageName' => $image->getName(), 'numDisk' => (string) $input->diskNumber, 'numPartition' => (string) $input->partitionNumber, ]; $agentJobId = $this->deployImageOgAgentAction->__invoke($image, $input, $client->getEntity(), DeployMethodTypes::UNICAST); if (!$agentJobId){ continue; } $this->createService->__invoke($client->getEntity(), CommandTypes::DEPLOY_IMAGE, TraceStatus::IN_PROGRESS, $agentJobId, $inputData); } break; case DeployMethodTypes::MULTICAST_UFTP: case DeployMethodTypes::MULTICAST_UFTP_DIRECT: case DeployMethodTypes::MULTICAST_UDPCAST: case DeployMethodTypes::MULTICAST_UDPCAST_DIRECT: foreach ($input->clients as $client) { $inputData = [ 'method' => $input->method, 'client' => $client->getEntity()->getUuid(), 'image' => $image->getUuid(), 'mcastIp' => $input->mcastIp, 'mcastPort' => $input->mcastPort, 'mcastSpeed' => $input->mcastSpeed, 'mcastMode' => $input->mcastMode, 'numDisk' => (string) $input->diskNumber, 'numPartition' => (string) $input->partitionNumber, ]; try { $this->deployImageOgRepositoryAction->__invoke($input, $image, $client->getEntity()); } catch (\Exception $e) { continue; } $agentJobId = $this->deployImageOgAgentAction->__invoke($image, $input, $client->getEntity(), DeployMethodTypes::MULTICAST); if (!$agentJobId){ continue; } $this->createService->__invoke($client->getEntity(), CommandTypes::DEPLOY_IMAGE, TraceStatus::IN_PROGRESS, $agentJobId, $inputData); } break; case DeployMethodTypes::TORRENT: foreach ($input->clients as $client) { $inputData = [ 'method' => $input->method, 'client' => $client->getEntity()->getUuid(), 'image' => $image->getUuid(), 'p2pMode' => $input->p2pMode, 'p2pTime' => $input->p2pTime, 'numDisk' => (string) $input->diskNumber, 'numPartition' => (string) $input->partitionNumber, ]; try { $this->deployImageOgRepositoryAction->__invoke($input, $image, $client->getEntity(), $this->httpClient); } catch (\Exception $e) { continue; } $agentJobId = $this->deployImageOgAgentAction->__invoke($image, $input, $client->getEntity(), DeployMethodTypes::TORRENT); if (!$agentJobId){ continue; } $this->createService->__invoke($client->getEntity(), CommandTypes::DEPLOY_IMAGE, TraceStatus::IN_PROGRESS, $agentJobId, $inputData); } break; } return new JsonResponse(data: [], status: Response::HTTP_OK); } }