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

LinodeType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 21
dl 0
loc 31
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 5 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\LinodeTypes;
13
14
use Linode\Entity;
15
use Linode\Linode\Price;
16
17
/**
18
 * Returns collection of Linode types, including pricing and specifications for each
19
 * type. These are used when creating or resizing Linodes.
20
 *
21
 * @property string      $id          The ID representing the Linode Type.
22
 * @property string      $label       The Linode Type's label is for display purposes only.
23
 * @property string      $class       The class of the Linode Type. We currently offer five classes of Linodes:
24
 *                                    * nanode - Nanode instances are good for low-duty workloads,
25
 *                                    where performance isn't critical.
26
 *                                    * standard - Standard instances are good for medium-duty workloads and
27
 *                                    are a good mix of performance, resources, and price.
28
 *                                    * dedicated - Dedicated CPU instances are good for full-duty workloads
29
 *                                    where consistent performance is important.
30
 *                                    * gpu - Linodes with dedicated NVIDIA Quadro (R) RTX 6000 GPUs accelerate highly
31
 *                                    specialized applications such as machine learning, AI, and video transcoding.
32
 *                                    * highmem - High Memory instances favor RAM over other resources, and can be
33
 *                                    good for memory hungry use cases like caching and in-memory databases.
34
 * @property int         $disk        The Disk size, in MB, of the Linode Type.
35
 * @property int         $memory      Amount of RAM included in this Linode Type.
36
 * @property int         $vcpus       The number of VCPU cores this Linode Type offers.
37
 * @property int         $network_out The Mbits outbound bandwidth allocation.
38
 * @property int         $transfer    The monthly outbound transfer amount, in MB.
39
 * @property int         $gpus        The number of GPUs this Linode Type offers.
40
 * @property Price       $price       Cost in US dollars, broken down into hourly and monthly charges.
41
 * @property object      $addons      A list of optional add-on services for Linodes and their associated costs.
42
 * @property null|string $successor   The Linode Type that a mutate will upgrade to for a Linode of this type. If
43
 *                                    "null", a Linode of this type may not mutate.
44
 */
45
class LinodeType extends Entity
46
{
47
    // Available fields.
48
    public const FIELD_ID          = 'id';
49
    public const FIELD_LABEL       = 'label';
50
    public const FIELD_CLASS       = 'class';
51
    public const FIELD_DISK        = 'disk';
52
    public const FIELD_MEMORY      = 'memory';
53
    public const FIELD_VCPUS       = 'vcpus';
54
    public const FIELD_NETWORK_OUT = 'network_out';
55
    public const FIELD_TRANSFER    = 'transfer';
56
    public const FIELD_GPUS        = 'gpus';
57
    public const FIELD_PRICE       = 'price';
58
    public const FIELD_ADDONS      = 'addons';
59
    public const FIELD_SUCCESSOR   = 'successor';
60
61
    // `FIELD_CLASS` values.
62
    public const CLASS_NANODE    = 'nanode';
63
    public const CLASS_STANDARD  = 'standard';
64
    public const CLASS_DEDICATED = 'dedicated';
65
    public const CLASS_GPU       = 'gpu';
66
    public const CLASS_HIGHMEM   = 'highmem';
67
68
    /**
69
     * @codeCoverageIgnore This method was autogenerated.
70
     */
71
    public function __get(string $name): mixed
72
    {
73
        return match ($name) {
74
            self::FIELD_PRICE => new Price($this->client, $this->data[$name]),
75
            default           => parent::__get($name),
76
        };
77
    }
78
}
79