2021-11-30 11:20:42 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace AIO\Container;
|
|
|
|
|
|
|
|
|
|
use AIO\Data\ConfigurationManager;
|
|
|
|
|
use AIO\Docker\DockerActionManager;
|
|
|
|
|
use AIO\ContainerDefinitionFetcher;
|
2026-01-10 15:07:08 +01:00
|
|
|
use JsonException;
|
2021-11-30 11:20:42 +01:00
|
|
|
|
2024-10-07 10:12:43 +02:00
|
|
|
readonly class Container {
|
2021-11-30 11:20:42 +01:00
|
|
|
public function __construct(
|
2026-01-10 15:07:08 +01:00
|
|
|
public string $identifier,
|
|
|
|
|
public string $displayName,
|
|
|
|
|
public string $containerName,
|
|
|
|
|
public string $restartPolicy,
|
|
|
|
|
public int $maxShutdownTime,
|
|
|
|
|
public ContainerPorts $ports,
|
|
|
|
|
public string $internalPorts,
|
|
|
|
|
public ContainerVolumes $volumes,
|
|
|
|
|
public ContainerEnvironmentVariables $containerEnvironmentVariables,
|
2024-10-07 10:12:43 +02:00
|
|
|
/** @var string[] */
|
2026-01-10 15:07:08 +01:00
|
|
|
public array $dependsOn,
|
2025-01-23 16:28:07 +01:00
|
|
|
private string $uiSecret,
|
2024-10-07 10:12:43 +02:00
|
|
|
/** @var string[] */
|
2026-01-10 15:07:08 +01:00
|
|
|
public array $devices,
|
|
|
|
|
public bool $enableNvidiaGpu,
|
2024-10-07 10:12:43 +02:00
|
|
|
/** @var string[] */
|
2026-01-10 15:07:08 +01:00
|
|
|
public array $capAdd,
|
|
|
|
|
public int $shmSize,
|
|
|
|
|
public bool $apparmorUnconfined,
|
2024-10-07 10:12:43 +02:00
|
|
|
/** @var string[] */
|
2026-01-10 15:07:08 +01:00
|
|
|
public array $backupVolumes,
|
|
|
|
|
public array $nextcloudExecCommands,
|
|
|
|
|
public bool $readOnlyRootFs,
|
|
|
|
|
public array $tmpfs,
|
|
|
|
|
public bool $init,
|
|
|
|
|
public string $imageTag,
|
|
|
|
|
public AioVariables $aioVariables,
|
|
|
|
|
public string $documentation,
|
2024-10-07 10:12:43 +02:00
|
|
|
private DockerActionManager $dockerActionManager
|
2021-11-30 11:20:42 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-23 16:28:07 +01:00
|
|
|
public function GetUiSecret() : string {
|
|
|
|
|
return $this->dockerActionManager->GetAndGenerateSecretWrapper($this->uiSecret);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 15:07:08 +01:00
|
|
|
/**
|
|
|
|
|
* @throws JsonException
|
|
|
|
|
*/
|
2024-10-07 13:20:49 +02:00
|
|
|
public function GetRunningState() : ContainerState {
|
2021-11-30 11:20:42 +01:00
|
|
|
return $this->dockerActionManager->GetContainerRunningState($this);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 15:07:08 +01:00
|
|
|
/**
|
|
|
|
|
* @throws JsonException
|
|
|
|
|
*/
|
2024-10-07 13:20:49 +02:00
|
|
|
public function GetRestartingState() : ContainerState {
|
2022-03-15 12:45:31 +01:00
|
|
|
return $this->dockerActionManager->GetContainerRestartingState($this);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-02 15:00:13 +02:00
|
|
|
public function GetUpdateState() : VersionState {
|
2021-11-30 11:20:42 +01:00
|
|
|
return $this->dockerActionManager->GetContainerUpdateState($this);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-07 13:20:49 +02:00
|
|
|
public function GetStartingState() : ContainerState {
|
2021-11-30 11:20:42 +01:00
|
|
|
return $this->dockerActionManager->GetContainerStartingState($this);
|
|
|
|
|
}
|
|
|
|
|
}
|