Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/Models/Servers/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function createInDatacenter(
$networks = [],
array $labels = [],
array $firewalls = [],
array $public_net = [],
?array $public_net = null,
?int $placement_group = null
): ?APIResponse {
$parameters = [
Expand All @@ -188,7 +188,6 @@ public function createInDatacenter(
'volumes' => $volumes,
'automount' => $automount,
'networks' => $networks,
'public_net' => $public_net,
];
if (! empty($labels)) {
$parameters['labels'] = $labels;
Expand All @@ -199,6 +198,9 @@ public function createInDatacenter(
if ($placement_group != null) {
$parameters['placement_group'] = $placement_group;
}
if ($public_net != null) {
$parameters['public_net'] = $public_net;
}
$response = $this->httpClient->post('servers', [
'json' => $parameters,
]);
Expand Down Expand Up @@ -252,7 +254,7 @@ public function createInLocation(string $name,
array $networks = [],
array $labels = [],
array $firewalls = [],
array $public_net = [],
?array $public_net = null,
?int $placement_group = null
): ?APIResponse {
$parameters = [
Expand All @@ -266,7 +268,6 @@ public function createInLocation(string $name,
'volumes' => $volumes,
'automount' => $automount,
'networks' => $networks,
'public_net' => $public_net,
];
if (! empty($labels)) {
$parameters['labels'] = $labels;
Expand All @@ -277,6 +278,9 @@ public function createInLocation(string $name,
if ($placement_group != null) {
$parameters['placement_group'] = $placement_group;
}
if ($public_net != null) {
$parameters['public_net'] = $public_net;
}
$response = $this->httpClient->post('servers', [
'json' => $parameters,
]);
Expand Down
21 changes: 21 additions & 0 deletions src/Models/Servers/Types/ServerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ class ServerType extends Model
*/
public $architecture;

/**
* Deprecation info if the server type is deprecated, null otherwise.
*
* @var array{announced: string, unavailable_after: string}|null
*/
public $deprecation;

/**
* Per-location availability info, keyed by location name.
* Each entry contains a deprecation object or null if still available.
*
* @var array<string, array{announced: string, unavailable_after: string}|null>
*/
public $locationAvailability = [];

/**
* ServerType constructor.
*
Expand Down Expand Up @@ -91,6 +106,12 @@ public function setAdditionalData($input)
$this->storageType = $input->storage_type ?? null;
$this->cpuType = $input->cpu_type ?? null;
$this->architecture = property_exists($input, 'architecture') ? $input->architecture : null;
$this->deprecation = (property_exists($input, 'deprecation') && $input->deprecation !== null) ? (array) $input->deprecation : null;
$locationAvailability = [];
foreach ($input->locations ?? [] as $loc) {
$locationAvailability[$loc->name] = ($loc->deprecation !== null) ? (array) $loc->deprecation : null;
}
$this->locationAvailability = $locationAvailability;

return $this;
}
Expand Down
Loading