Passed
Push — master ( 0676a7...01ab94 )
by Artem
11:54
created

LinodeConfig   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 20
dl 0
loc 32
c 1
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 6 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\LinodeInstances;
13
14
use Linode\Entity;
15
16
/**
17
 * Configuration profile associated with a Linode.
18
 *
19
 * @property int         $id           The ID of this Config.
20
 * @property string      $label        The Config's label is for display purposes only.
21
 * @property string      $kernel       A Kernel ID to boot a Linode with. Defaults to "linode/latest-64bit".
22
 * @property null|string $comments     Optional field for arbitrary User comments on this Config.
23
 * @property int         $memory_limit Defaults to the total RAM of the Linode.
24
 * @property string      $run_level    Defines the state of your Linode after booting. Defaults to `default`.
25
 * @property string      $virt_mode    Controls the virtualization mode. Defaults to `paravirt`.
26
 *                                     * `paravirt` is suitable for most cases. Linodes running in paravirt mode
27
 *                                     share some qualities with the host, ultimately making it run faster since
28
 *                                     there is less transition between it and the host.
29
 *                                     * `full_virt` affords more customization, but is slower because 100% of the VM
30
 *                                     is virtualized.
31
 * @property Helpers     $helpers      Helpers enabled when booting to this Linode Config.
32
 * @property Devices     $devices      Devices configuration
33
 * @property string      $root_device  The root device to boot.
34
 *                                     * If no value or an invalid value is provided, root device will default to
35
 *                                     `/dev/sda`.
36
 *                                     * If the device specified at the root device location is not mounted, the Linode
37
 *                                     will not boot until a device is mounted.
38
 */
39
class LinodeConfig extends Entity
40
{
41
    // Available fields.
42
    public const FIELD_ID           = 'id';
43
    public const FIELD_LABEL        = 'label';
44
    public const FIELD_KERNEL       = 'kernel';
45
    public const FIELD_COMMENTS     = 'comments';
46
    public const FIELD_MEMORY_LIMIT = 'memory_limit';
47
    public const FIELD_RUN_LEVEL    = 'run_level';
48
    public const FIELD_VIRT_MODE    = 'virt_mode';
49
    public const FIELD_HELPERS      = 'helpers';
50
    public const FIELD_DEVICES      = 'devices';
51
    public const FIELD_ROOT_DEVICE  = 'root_device';
52
53
    // `FIELD_RUN_LEVEL` values.
54
    public const RUN_LEVEL_DEFAULT = 'default';
55
    public const RUN_LEVEL_SINGLE  = 'single';
56
    public const RUN_LEVEL_BINBASH = 'binbash';
57
58
    // `FIELD_VIRT_MODE` values.
59
    public const VIRT_MODE_PARAVIRT = 'paravirt';
60
    public const VIRT_MODE_FULLVIRT = 'fullvirt';
61
62
    /**
63
     * @codeCoverageIgnore This method was autogenerated.
64
     */
65
    public function __get(string $name): mixed
66
    {
67
        return match ($name) {
68
            self::FIELD_HELPERS => new Helpers($this->client, $this->data[$name]),
69
            self::FIELD_DEVICES => new Devices($this->client, $this->data[$name]),
70
            default             => parent::__get($name),
71
        };
72
    }
73
}
74