validator->validate($input); if (!$input->client) { throw new \InvalidArgumentException('Client is required'); } if (!$input->partition) { throw new \InvalidArgumentException('Partition is required'); } $this->handleGitUpdate($input); return new JsonResponse(data: [], status: Response::HTTP_OK); } private function handleGitUpdate(UpdateGitImageInput $input): void { $client = $input->client->getEntity(); $partition = $input->partition->getEntity(); $inputData = $this->createInputData($input, $client, $partition); $this->processUpdate($client, $input, $inputData, DeployMethodTypes::GIT); } private function processUpdate(Client $client, UpdateGitImageInput $input, array $inputData, string $updateType): void { $agentJobId = $this->updateGitImageOgAgentAction->__invoke($input, $client); if (!$agentJobId) { if ($input->queue) { $this->createService->__invoke($client, CommandTypes::UPDATE_IMAGE_GIT, TraceStatus::PENDING, null, $inputData); } return; } $this->createService->__invoke($client, CommandTypes::UPDATE_IMAGE_GIT, TraceStatus::IN_PROGRESS, $agentJobId, $inputData); } private function createInputData(UpdateGitImageInput $input, Client $client, $partition): array { return [ 'method' => 'ModificarImagenGit', 'type' => 'git', 'client' => $client->getUuid(), 'diskNumber' => $partition->getDiskNumber(), 'partitionNumber' => $partition->getPartitionNumber(), 'repositoryName' => $input->gitRepository, 'options' => $input->options ? 'force push' : null, ]; } }