mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
Initial import
This commit is contained in:
commit
2295a33590
884 changed files with 93939 additions and 0 deletions
112
php/src/Container/Container.php
Normal file
112
php/src/Container/Container.php
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
use AIO\Container\State\IContainerState;
|
||||
use AIO\Data\ConfigurationManager;
|
||||
use AIO\Docker\DockerActionManager;
|
||||
use AIO\ContainerDefinitionFetcher;
|
||||
|
||||
class Container {
|
||||
private string $identifier;
|
||||
private string $displayName;
|
||||
private string $containerName;
|
||||
private string $restartPolicy;
|
||||
private int $maxShutdownTime;
|
||||
private ContainerPorts $ports;
|
||||
private ContainerInternalPorts $internalPorts;
|
||||
private ContainerVolumes $volumes;
|
||||
private ContainerEnvironmentVariables $containerEnvironmentVariables;
|
||||
/** @var string[] */
|
||||
private array $dependsOn;
|
||||
/** @var string[] */
|
||||
private array $secrets;
|
||||
private DockerActionManager $dockerActionManager;
|
||||
|
||||
public function __construct(
|
||||
string $identifier,
|
||||
string $displayName,
|
||||
string $containerName,
|
||||
string $restartPolicy,
|
||||
int $maxShutdownTime,
|
||||
ContainerPorts $ports,
|
||||
ContainerInternalPorts $internalPorts,
|
||||
ContainerVolumes $volumes,
|
||||
ContainerEnvironmentVariables $containerEnvironmentVariables,
|
||||
array $dependsOn,
|
||||
array $secrets,
|
||||
DockerActionManager $dockerActionManager
|
||||
) {
|
||||
$this->identifier = $identifier;
|
||||
$this->displayName = $displayName;
|
||||
$this->containerName = $containerName;
|
||||
$this->restartPolicy = $restartPolicy;
|
||||
$this->maxShutdownTime = $maxShutdownTime;
|
||||
$this->ports = $ports;
|
||||
$this->internalPorts = $internalPorts;
|
||||
$this->volumes = $volumes;
|
||||
$this->containerEnvironmentVariables = $containerEnvironmentVariables;
|
||||
$this->dependsOn = $dependsOn;
|
||||
$this->secrets = $secrets;
|
||||
$this->dockerActionManager = $dockerActionManager;
|
||||
}
|
||||
|
||||
public function GetIdentifier() : string {
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function GetDisplayName() : string {
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
public function GetContainerName() : string {
|
||||
return $this->containerName;
|
||||
}
|
||||
|
||||
public function GetRestartPolicy() : string {
|
||||
return $this->restartPolicy;
|
||||
}
|
||||
|
||||
public function GetMaxShutdownTime() : int {
|
||||
return $this->maxShutdownTime;
|
||||
}
|
||||
|
||||
public function GetSecrets() : array {
|
||||
return $this->secrets;
|
||||
}
|
||||
|
||||
public function GetPorts() : ContainerPorts {
|
||||
return $this->ports;
|
||||
}
|
||||
|
||||
public function GetInternalPorts() : ContainerInternalPorts {
|
||||
return $this->internalPorts;
|
||||
}
|
||||
|
||||
public function GetVolumes() : ContainerVolumes {
|
||||
return $this->volumes;
|
||||
}
|
||||
|
||||
public function GetRunningState() : IContainerState {
|
||||
return $this->dockerActionManager->GetContainerRunningState($this);
|
||||
}
|
||||
|
||||
public function GetUpdateState() : IContainerState {
|
||||
return $this->dockerActionManager->GetContainerUpdateState($this);
|
||||
}
|
||||
|
||||
public function GetStartingState() : IContainerState {
|
||||
return $this->dockerActionManager->GetContainerStartingState($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetDependsOn() : array {
|
||||
return $this->dependsOn;
|
||||
}
|
||||
|
||||
public function GetEnvironmentVariables() : ContainerEnvironmentVariables {
|
||||
return $this->containerEnvironmentVariables;
|
||||
}
|
||||
}
|
||||
19
php/src/Container/ContainerEnvironmentVariables.php
Normal file
19
php/src/Container/ContainerEnvironmentVariables.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
class ContainerEnvironmentVariables {
|
||||
/** @var string[] */
|
||||
private array $variables = [];
|
||||
|
||||
public function AddVariable(string $variable) : void {
|
||||
$this->variables[] = $variable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetVariables() : array {
|
||||
return $this->variables;
|
||||
}
|
||||
}
|
||||
19
php/src/Container/ContainerInternalPorts.php
Normal file
19
php/src/Container/ContainerInternalPorts.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
class ContainerInternalPorts {
|
||||
/** @var string[] */
|
||||
private array $internalPorts = [];
|
||||
|
||||
public function AddInternalPort(string $internalPort) : void {
|
||||
$this->internalPorts[] = $internalPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetInternalPorts() : array {
|
||||
return $this->internalPorts;
|
||||
}
|
||||
}
|
||||
19
php/src/Container/ContainerPorts.php
Normal file
19
php/src/Container/ContainerPorts.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
class ContainerPorts {
|
||||
/** @var string[] */
|
||||
private array $ports = [];
|
||||
|
||||
public function AddPort(string $port) : void {
|
||||
$this->ports[] = $port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetPorts() : array {
|
||||
return $this->ports;
|
||||
}
|
||||
}
|
||||
19
php/src/Container/ContainerVolume.php
Normal file
19
php/src/Container/ContainerVolume.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
class ContainerVolume {
|
||||
public string $name;
|
||||
public string $mountPoint;
|
||||
public bool $isWritable;
|
||||
|
||||
public function __construct(
|
||||
string $name,
|
||||
string $mountPoint,
|
||||
bool $isWritable
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->mountPoint = $mountPoint;
|
||||
$this->isWritable = $isWritable;
|
||||
}
|
||||
}
|
||||
19
php/src/Container/ContainerVolumes.php
Normal file
19
php/src/Container/ContainerVolumes.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container;
|
||||
|
||||
class ContainerVolumes {
|
||||
/** @var ContainerVolume[] */
|
||||
private array $volumes = [];
|
||||
|
||||
public function AddVolume(ContainerVolume $volume) {
|
||||
$this->volumes[] = $volume;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContainerVolume[]
|
||||
*/
|
||||
public function GetVolumes() : array {
|
||||
return $this->volumes;
|
||||
}
|
||||
}
|
||||
5
php/src/Container/State/IContainerState.php
Normal file
5
php/src/Container/State/IContainerState.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
interface IContainerState {}
|
||||
6
php/src/Container/State/ImageDoesNotExistState.php
Normal file
6
php/src/Container/State/ImageDoesNotExistState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class ImageDoesNotExistState implements IContainerState
|
||||
{}
|
||||
6
php/src/Container/State/RunningState.php
Normal file
6
php/src/Container/State/RunningState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class RunningState implements IContainerState
|
||||
{}
|
||||
6
php/src/Container/State/StartingState.php
Normal file
6
php/src/Container/State/StartingState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class StartingState implements IContainerState
|
||||
{}
|
||||
6
php/src/Container/State/StoppedState.php
Normal file
6
php/src/Container/State/StoppedState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class StoppedState implements IContainerState
|
||||
{}
|
||||
6
php/src/Container/State/VersionDifferentState.php
Normal file
6
php/src/Container/State/VersionDifferentState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class VersionDifferentState implements IContainerState
|
||||
{}
|
||||
6
php/src/Container/State/VersionEqualState.php
Normal file
6
php/src/Container/State/VersionEqualState.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Container\State;
|
||||
|
||||
class VersionEqualState implements IContainerState
|
||||
{}
|
||||
Loading…
Add table
Add a link
Reference in a new issue