refs #1088. Deploy Image
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
parent
e0795743e7
commit
aee03d6a85
|
@ -2,7 +2,52 @@
|
|||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Dto\Output\ImageOutput;
|
||||
use App\Dto\Output\PartitionOutput;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
|
||||
use App\Validator\Constraints\OrganizationalUnitP2PMode;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
class DeployImageInput
|
||||
{
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The type of the image deployment', example: "")]
|
||||
public ?string $type = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The type of the image deployment', example: "")]
|
||||
public ?string $method = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The client to deploy the image')]
|
||||
public ?ClientOutput $client = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The partition to deploy the image')]
|
||||
public ?PartitionOutput $partition = null;
|
||||
|
||||
#[OrganizationalUnitP2PMode]
|
||||
#[Groups(['image:write'])]
|
||||
public ?string $p2pMode = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?int $p2pTime = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
public ?string $mcastIp = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
public ?int $mcastSpeed = null;
|
||||
|
||||
#[OrganizationalUnitMulticastPort]
|
||||
#[Groups(['image:write'])]
|
||||
public ?int $mcastPort = null;
|
||||
|
||||
#[OrganizationalUnitMulticastMode]
|
||||
#[Groups(['image:write'])]
|
||||
public ?string $mcastMode = null;
|
||||
|
||||
}
|
|
@ -2,7 +2,27 @@
|
|||
|
||||
namespace App\Model;
|
||||
|
||||
class DeployImageTypes
|
||||
final class DeployImageTypes
|
||||
{
|
||||
public const string DEPLOY_IMAGE = 'deploy-image';
|
||||
public const string UPDATE_CACHE = 'update-cache';
|
||||
private const array DEPLOYMENT_IMAGE_TYPES = [
|
||||
self::DEPLOY_IMAGE => 'Unidad Organizativa',
|
||||
self::UPDATE_CACHE => 'Grupo de aulas',
|
||||
];
|
||||
|
||||
public static function getDeploymentImageTypes(): array
|
||||
{
|
||||
return self::DEPLOYMENT_IMAGE_TYPES;
|
||||
}
|
||||
|
||||
public static function getDeploymentImageType(string $type): ?string
|
||||
{
|
||||
return self::DEPLOYMENT_IMAGE_TYPES[$type] ?? null;
|
||||
}
|
||||
|
||||
public static function getDeploymentImageTypeKeys(): array
|
||||
{
|
||||
return array_keys(self::DEPLOYMENT_IMAGE_TYPES);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,29 @@
|
|||
|
||||
namespace App\Model;
|
||||
|
||||
class DeployMethodTypes
|
||||
final class DeployMethodTypes
|
||||
{
|
||||
public const string MULTICAST = 'multicast';
|
||||
public const string UNICAST = 'unicast';
|
||||
public const string TORRENT = 'torrent';
|
||||
|
||||
private const array DEPLOYMENT_METHOD_TYPES = [
|
||||
self::MULTICAST => 'Multicast',
|
||||
self::UNICAST => 'Unicast',
|
||||
self::TORRENT => 'Torrent',
|
||||
];
|
||||
|
||||
public static function getDeploymentMethodTypes(): array
|
||||
{
|
||||
return self::DEPLOYMENT_METHOD_TYPES;
|
||||
}
|
||||
|
||||
public static function getDeploymentMethodType(string $type): ?string
|
||||
{
|
||||
return self::DEPLOYMENT_METHOD_TYPES[$type] ?? null;
|
||||
}
|
||||
public static function getDeploymentMethodTypeKeys(): array
|
||||
{
|
||||
return array_keys(self::DEPLOYMENT_METHOD_TYPES);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,34 @@
|
|||
|
||||
namespace App\Model;
|
||||
|
||||
class ImageStatus
|
||||
final class ImageStatus
|
||||
{
|
||||
public const string PENDING = 'pending';
|
||||
public const string IN_PROGRESS = 'in-progress';
|
||||
public const string SUCCESS = 'success';
|
||||
public const string TRASH = 'trash';
|
||||
public const string FAILED = 'failed';
|
||||
|
||||
private const array STATUS = [
|
||||
self::PENDING => 'Pendiente',
|
||||
self::IN_PROGRESS => 'En progreso',
|
||||
self::TRASH => 'Papelera',
|
||||
self::SUCCESS => 'Completado',
|
||||
self::FAILED => 'Fallido',
|
||||
];
|
||||
|
||||
public static function getStatus(): array
|
||||
{
|
||||
return self::STATUS;
|
||||
}
|
||||
|
||||
public static function getImageStatus(string $status): ?string
|
||||
{
|
||||
return self::STATUS[$status] ?? null;
|
||||
}
|
||||
|
||||
public static function getStatusKeys(): array
|
||||
{
|
||||
return array_keys(self::STATUS);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ use ApiPlatform\Metadata\Post;
|
|||
use ApiPlatform\Metadata\Put;
|
||||
use ApiPlatform\State\ProcessorInterface;
|
||||
use ApiPlatform\Validator\ValidatorInterface;
|
||||
use App\Controller\OgAgent\CreateImageActionController;
|
||||
use App\Controller\OgAgent\CreateImageAction;
|
||||
use App\Dto\Input\ImageInput;
|
||||
use App\Dto\Output\ImageOutput;
|
||||
use App\Repository\ImageRepository;
|
||||
|
@ -19,7 +19,7 @@ readonly class ImageProcessor implements ProcessorInterface
|
|||
public function __construct(
|
||||
private ImageRepository $imageRepository,
|
||||
private ValidatorInterface $validator,
|
||||
private CreateImageActionController $createImageActionController
|
||||
private CreateImageAction $createImageActionController
|
||||
)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue