all-in-one/php/src/Container/Container.php

70 lines
2.6 KiB
PHP
Raw Normal View History

2021-11-30 11:20:42 +01:00
<?php
namespace AIO\Container;
use AIO\Data\ConfigurationManager;
use AIO\Docker\DockerActionManager;
use AIO\ContainerDefinitionFetcher;
use JsonException;
2021-11-30 11:20:42 +01:00
readonly class Container {
2021-11-30 11:20:42 +01:00
public function __construct(
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,
/** @var string[] */
public array $dependsOn,
private string $uiSecret,
/** @var string[] */
public array $devices,
public bool $enableNvidiaGpu,
/** @var string[] */
public array $capAdd,
public int $shmSize,
public bool $apparmorUnconfined,
/** @var string[] */
public array $backupVolumes,
public array $nextcloudExecCommands,
public bool $readOnlyRootFs,
public array $tmpfs,
public bool $init,
public string $imageTag,
public AioVariables $aioVariables,
public string $documentation,
private DockerActionManager $dockerActionManager
2021-11-30 11:20:42 +01:00
) {
}
public function GetUiSecret() : string {
return $this->dockerActionManager->GetAndGenerateSecretWrapper($this->uiSecret);
}
/**
* @throws JsonException
*/
public function GetRunningState() : ContainerState {
2021-11-30 11:20:42 +01:00
return $this->dockerActionManager->GetContainerRunningState($this);
}
/**
* @throws JsonException
*/
public function GetRestartingState() : ContainerState {
return $this->dockerActionManager->GetContainerRestartingState($this);
}
public function GetUpdateState() : VersionState {
2021-11-30 11:20:42 +01:00
return $this->dockerActionManager->GetContainerUpdateState($this);
}
public function GetStartingState() : ContainerState {
2021-11-30 11:20:42 +01:00
return $this->dockerActionManager->GetContainerStartingState($this);
}
}