-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathServerInfoResult.php
241 lines (217 loc) · 6 KB
/
ServerInfoResult.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
declare(strict_types=1);
namespace Upmind\ProvisionProviders\Servers\Data;
use Upmind\ProvisionBase\Provider\DataSet\ResultData;
use Upmind\ProvisionBase\Provider\DataSet\Rules;
/**
* @property-read string $instance_id Server instance identifier
* @property-read string $state Server state e.g., ready/suspended/pending etc
* @property-read bool|null $suspended Whether the server is suspended
* @property-read string $label Server instance label/name
* @property-read string|null $hostname Server hostname
* @property-read string|null $ip_address Server IP address
* @property-read string $image Image name/identifier
* @property-read string $size Server specs/size name
* @property-read integer $memory_mb Server video memory in megabytes
* @property-read integer $cpu_cores Server number of CPUs
* @property-read integer $disk_mb Server RAM size in megabytes
* @property-read string $location Server dc/location/region
* @property-read string|null $node Server host node name
* @property-read string|null $virtualization_type
* @property-read string|int|null $customer_identifier
* @property-read string|null $created_at
* @property-read string|null $updated_at
* @property-read array|null $software
* @property-read array|null $licenses
* @property-read array|null $metadata
*/
class ServerInfoResult extends ResultData
{
public static function rules(): Rules
{
return new Rules([
'instance_id' => ['required', 'string'],
'state' => ['required', 'string'],
'suspended' => ['nullable', 'bool'],
'label' => ['required', 'string'],
'hostname' => ['nullable', 'alpha_dash_dot'],
'ip_address' => ['nullable', 'string'],
'image' => ['required', 'string'],
'size' => ['required_without:memory_mb,cpu_cores,disk_mb', 'string'],
'memory_mb' => ['required_without:size', 'integer'],
'cpu_cores' => ['required_without:size', 'integer'],
'disk_mb' => ['required_without:size', 'integer'],
'location' => ['required', 'string'],
'node' => ['nullable', 'string'],
'virtualization_type' => ['nullable', 'string'],
'customer_identifier' => ['nullable'],
'created_at' => ['date_format:Y-m-d H:i:s'],
'updated_at' => ['date_format:Y-m-d H:i:s'],
'software' => ['nullable', 'array'],
'licenses' => ['nullable', 'array'],
'metadata' => ['nullable', 'array'],
]);
}
/**
* @return static $this
*/
public function setState(string $state)
{
$this->setValue('state', $state);
return $this;
}
/**
* @return static $this
*/
public function setSuspended(?bool $suspended)
{
$this->setValue('suspended', $suspended);
return $this;
}
/**
* @return static $this
*/
public function setInstanceId(string $instanceId)
{
$this->setValue('instance_id', $instanceId);
return $this;
}
/**
* @return static $this
*/
public function setLabel(string $label)
{
$this->setValue('label', $label);
return $this;
}
/**
* @return static $this
*/
public function setHostname(?string $hostname)
{
$this->setValue('hostname', $hostname);
return $this;
}
/**
* @return static $this
*/
public function setIpAddress(?string $ipAddress)
{
$this->setValue('ip_address', $ipAddress);
return $this;
}
/**
* @return static $this
*/
public function setImage(string $image)
{
$this->setValue('image', $image);
return $this;
}
/**
* @return static $this
*/
public function setSize(?string $size)
{
$this->setValue('size', $size);
return $this;
}
/**
* @return static $this
*/
public function setMemoryMb(?int $memoryMb)
{
$this->setValue('memory_mb', $memoryMb);
return $this;
}
/**
* @return static $this
*/
public function setCpuCores(?int $cpuCores)
{
$this->setValue('cpu_cores', $cpuCores);
return $this;
}
/**
* @return static $this
*/
public function setDiskMb(?int $diskMb)
{
$this->setValue('disk_mb', $diskMb);
return $this;
}
/**
* @return static $this
*/
public function setLocation(string $location)
{
$this->setValue('location', $location);
return $this;
}
/**
* @return static $this
*/
public function setNode(?string $node)
{
$this->setValue('node', $node);
return $this;
}
/**
* @return static $this
*/
public function setVirtualizationType(?string $type)
{
$this->setValue('virtualization_type', $type);
return $this;
}
/**
* @param string|int|null $customerIdentifier
*
* @return static $this
*/
public function setCustomerIdentifier($customerIdentifier)
{
$this->setValue('customer_identifier', $customerIdentifier);
return $this;
}
/**
* @return static $this
*/
public function setCreatedAt(string $createdAt)
{
$this->setValue('created_at', $createdAt);
return $this;
}
/**
* @return static $this
*/
public function setUpdatedAt(string $updatedAt)
{
$this->setValue('updated_at', $updatedAt);
return $this;
}
/**
* @return static $this
*/
public function setSoftware(?array $software)
{
$this->setValue('software', $software);
return $this;
}
/**
* @return static $this
*/
public function setLicenses(?array $licenses)
{
$this->setValue('licenses', $licenses);
return $this;
}
/**
* @return static $this
*/
public function setMetadata(?array $metadata)
{
$this->setValue('metadata', $metadata);
return $this;
}
}