Passed
Push — master ( 851c5d...3501a4 )
by Artem
01:43
created

LKECluster::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
// ---------------------------------------------------------------------
4
//
5
//  Copyright (C) 2018-2024 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <https://opensource.org/licenses/MIT>.
9
//
10
// ---------------------------------------------------------------------
11
12
namespace Linode\LKE;
13
14
use Linode\Entity;
15
use Linode\LKE\Repository\LKENodePoolRepository;
16
17
/**
18
 * A Kubernetes cluster.
19
 *
20
 * @property int                            $id          This Kubernetes cluster's unique ID.
21
 * @property string                         $label       This Kubernetes cluster's unique label for display purposes only. If no label is
22
 *                                                       provided, one will be assigned automatically.
23
 * @property string                         $region      This Kubernetes cluster's location.
24
 * @property string                         $created     When this Kubernetes cluster was created.
25
 * @property string                         $updated     When this Kubernetes cluster was updated.
26
 * @property string                         $k8s_version The desired Kubernetes version for this Kubernetes cluster in the format of
27
 *                                                       <major>.<minor>, and the latest supported patch version will be deployed.
28
 * @property string[]                       $tags        An array of tags applied to the Kubernetes cluster. Tags are for organizational
29
 *                                                       purposes only.
30
 * @property LKENodePoolRepositoryInterface $nodePools   Node pools.
31
 */
32
class LKECluster extends Entity
33
{
34
    // Available fields.
35
    public const FIELD_ID          = 'id';
36
    public const FIELD_LABEL       = 'label';
37
    public const FIELD_REGION      = 'region';
38
    public const FIELD_CREATED     = 'created';
39
    public const FIELD_UPDATED     = 'updated';
40
    public const FIELD_K8S_VERSION = 'k8s_version';
41
    public const FIELD_TAGS        = 'tags';
42
43
    // Extra fields for POST/PUT requests.
44
    public const FIELD_NODE_POOLS = 'node_pools';
45
46
    /**
47
     * @codeCoverageIgnore This method was autogenerated.
48
     */
49
    public function __get(string $name): mixed
50
    {
51
        return match ($name) {
52
            'nodePools' => new LKENodePoolRepository($this->client, $this->id),
53
            default     => parent::__get($name),
54
        };
55
    }
56
}
57