|
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. |
|
24
|
|
|
* We currently offer six classes of compute instances: |
|
25
|
|
|
* * `nanode` - Nanode instances are good for low-duty workloads, where performance |
|
26
|
|
|
* isn't critical. **Note:** As of June 16th, 2020, Nanodes became 1 GB Linodes in |
|
27
|
|
|
* the Cloud Manager, however, the API, the CLI, and billing will continue to refer |
|
28
|
|
|
* to these instances as Nanodes. |
|
29
|
|
|
* * `standard` - Standard Shared instances are good for medium-duty workloads and |
|
30
|
|
|
* are a good mix of performance, resources, and price. **Note:** As of June 16th, |
|
31
|
|
|
* 2020, Standard Linodes in the Cloud Manager became Shared Linodes, however, the |
|
32
|
|
|
* API, the CLI, and billing will continue to refer to these instances as Standard |
|
33
|
|
|
* Linodes. |
|
34
|
|
|
* * `dedicated` - Dedicated CPU instances are good for full-duty workloads where |
|
35
|
|
|
* consistent performance is important. |
|
36
|
|
|
* * `premium` (limited Regions) - In addition to the features of Dedicated |
|
37
|
|
|
* instances, Premium instances come equipped with the latest AMD EPYC™ CPUs, |
|
38
|
|
|
* ensuring your applications are running on the latest hardware with consistently |
|
39
|
|
|
* high performance. Only available in Regions with "Premium Plans" in their |
|
40
|
|
|
* `capabilities` |
|
41
|
|
|
* * `gpu` (limited Regions) - Linodes with dedicated NVIDIA Quadro(R) RTX 6000 |
|
42
|
|
|
* GPUs accelerate highly specialized applications such as machine learning, AI, and |
|
43
|
|
|
* video transcoding. Only available in Regions with "GPU Linodes" in their |
|
44
|
|
|
* `capabilities` |
|
45
|
|
|
* * `highmem` - High Memory instances favor RAM over other resources, and can be |
|
46
|
|
|
* good for memory hungry use cases like caching and in-memory databases. All High |
|
47
|
|
|
* Memory plans contain dedicated CPU cores. |
|
48
|
|
|
* @property int $disk The Disk size, in MB, of the Linode Type. |
|
49
|
|
|
* @property int $memory Amount of RAM included in this Linode Type. |
|
50
|
|
|
* @property int $vcpus The number of VCPU cores this Linode Type offers. |
|
51
|
|
|
* @property int $gpus The number of GPUs this Linode Type offers. |
|
52
|
|
|
* @property int $network_out The Mbits outbound bandwidth allocation. |
|
53
|
|
|
* @property int $transfer The monthly outbound transfer amount, in MB. |
|
54
|
|
|
* @property Price $price The default cost of provisioning this Linode Type. Prices are in US dollars, |
|
55
|
|
|
* broken down into hourly and monthly charges. |
|
56
|
|
|
* Certain Regions have different prices from the default. For Region-specific |
|
57
|
|
|
* prices, see `region_prices`. |
|
58
|
|
|
* @property RegionPrice[] $region_prices |
|
59
|
|
|
* @property object $addons A list of optional add-on services for Linodes and their associated costs. |
|
60
|
|
|
* @property null|string $successor The Linode Type that a mutate will upgrade to for a Linode of this type. If |
|
61
|
|
|
* "null", a Linode of this type may not mutate. |
|
62
|
|
|
*/ |
|
63
|
|
|
class LinodeType extends Entity |
|
64
|
|
|
{ |
|
65
|
|
|
// Available fields. |
|
66
|
|
|
public const FIELD_ID = 'id'; |
|
67
|
|
|
public const FIELD_LABEL = 'label'; |
|
68
|
|
|
public const FIELD_CLASS = 'class'; |
|
69
|
|
|
public const FIELD_DISK = 'disk'; |
|
70
|
|
|
public const FIELD_MEMORY = 'memory'; |
|
71
|
|
|
public const FIELD_VCPUS = 'vcpus'; |
|
72
|
|
|
public const FIELD_GPUS = 'gpus'; |
|
73
|
|
|
public const FIELD_NETWORK_OUT = 'network_out'; |
|
74
|
|
|
public const FIELD_TRANSFER = 'transfer'; |
|
75
|
|
|
public const FIELD_PRICE = 'price'; |
|
76
|
|
|
public const FIELD_REGION_PRICES = 'region_prices'; |
|
77
|
|
|
public const FIELD_ADDONS = 'addons'; |
|
78
|
|
|
public const FIELD_SUCCESSOR = 'successor'; |
|
79
|
|
|
|
|
80
|
|
|
// `FIELD_CLASS` values. |
|
81
|
|
|
public const CLASS_NANODE = 'nanode'; |
|
82
|
|
|
public const CLASS_STANDARD = 'standard'; |
|
83
|
|
|
public const CLASS_DEDICATED = 'dedicated'; |
|
84
|
|
|
public const CLASS_PREMIUM = 'premium'; |
|
85
|
|
|
public const CLASS_GPU = 'gpu'; |
|
86
|
|
|
public const CLASS_HIGHMEM = 'highmem'; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
|
90
|
|
|
*/ |
|
91
|
|
|
public function __get(string $name): mixed |
|
92
|
|
|
{ |
|
93
|
|
|
return match ($name) { |
|
94
|
|
|
self::FIELD_PRICE => new Price($this->client, $this->data[$name]), |
|
95
|
|
|
self::FIELD_REGION_PRICES => array_map(fn ($data) => new RegionPrice($this->client, $data), $this->data[$name]), |
|
96
|
|
|
default => parent::__get($name), |
|
97
|
|
|
}; |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|