|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace AsyncAws\CodeBuild\ValueObject; |
| 4 | + |
| 5 | +use AsyncAws\CodeBuild\Enum\ComputeType; |
| 6 | +use AsyncAws\Core\Exception\InvalidArgument; |
| 7 | + |
| 8 | +/** |
| 9 | + * Contains docker server information. |
| 10 | + */ |
| 11 | +final class DockerServer |
| 12 | +{ |
| 13 | + /** |
| 14 | + * Information about the compute resources the docker server uses. Available values include: |
| 15 | + * |
| 16 | + * - `BUILD_GENERAL1_SMALL`: Use up to 4 GiB memory and 2 vCPUs for your docker server. |
| 17 | + * - `BUILD_GENERAL1_MEDIUM`: Use up to 8 GiB memory and 4 vCPUs for your docker server. |
| 18 | + * - `BUILD_GENERAL1_LARGE`: Use up to 16 GiB memory and 8 vCPUs for your docker server. |
| 19 | + * - `BUILD_GENERAL1_XLARGE`: Use up to 64 GiB memory and 32 vCPUs for your docker server. |
| 20 | + * - `BUILD_GENERAL1_2XLARGE`: Use up to 128 GiB memory and 64 vCPUs for your docker server. |
| 21 | + * |
| 22 | + * @var ComputeType::* |
| 23 | + */ |
| 24 | + private $computeType; |
| 25 | + |
| 26 | + /** |
| 27 | + * A list of one or more security groups IDs. |
| 28 | + * |
| 29 | + * > Security groups configured for Docker servers should allow ingress network traffic from the VPC configured in the |
| 30 | + * > project. They should allow ingress on port 9876. |
| 31 | + * |
| 32 | + * @var string[]|null |
| 33 | + */ |
| 34 | + private $securityGroupIds; |
| 35 | + |
| 36 | + /** |
| 37 | + * A DockerServerStatus object to use for this docker server. |
| 38 | + * |
| 39 | + * @var DockerServerStatus|null |
| 40 | + */ |
| 41 | + private $status; |
| 42 | + |
| 43 | + /** |
| 44 | + * @param array{ |
| 45 | + * computeType: ComputeType::*, |
| 46 | + * securityGroupIds?: null|string[], |
| 47 | + * status?: null|DockerServerStatus|array, |
| 48 | + * } $input |
| 49 | + */ |
| 50 | + public function __construct(array $input) |
| 51 | + { |
| 52 | + $this->computeType = $input['computeType'] ?? $this->throwException(new InvalidArgument('Missing required field "computeType".')); |
| 53 | + $this->securityGroupIds = $input['securityGroupIds'] ?? null; |
| 54 | + $this->status = isset($input['status']) ? DockerServerStatus::create($input['status']) : null; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * @param array{ |
| 59 | + * computeType: ComputeType::*, |
| 60 | + * securityGroupIds?: null|string[], |
| 61 | + * status?: null|DockerServerStatus|array, |
| 62 | + * }|DockerServer $input |
| 63 | + */ |
| 64 | + public static function create($input): self |
| 65 | + { |
| 66 | + return $input instanceof self ? $input : new self($input); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @return ComputeType::* |
| 71 | + */ |
| 72 | + public function getComputeType(): string |
| 73 | + { |
| 74 | + return $this->computeType; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * @return string[] |
| 79 | + */ |
| 80 | + public function getSecurityGroupIds(): array |
| 81 | + { |
| 82 | + return $this->securityGroupIds ?? []; |
| 83 | + } |
| 84 | + |
| 85 | + public function getStatus(): ?DockerServerStatus |
| 86 | + { |
| 87 | + return $this->status; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * @return never |
| 92 | + */ |
| 93 | + private function throwException(\Throwable $exception) |
| 94 | + { |
| 95 | + throw $exception; |
| 96 | + } |
| 97 | +} |
0 commit comments