lkdevelopment / hetzner-cloud-php-sdk Goto Github PK
View Code? Open in Web Editor NEWA PHP SDK for the Hetzner Cloud API
License: MIT License
A PHP SDK for the Hetzner Cloud API
License: MIT License
Maybe I'm just too stoopid but
$hetznerClient->loadBalancers()->getByName();
also ByID
both throw
PHP Fatal error: Uncaught TypeError: LKDev\HetznerCloud\Models\LoadBalancerTypes\LoadBalancerType::__construct(): Argument #3 ($deprecated) must be of type string, null given
Beim holen aller Datacenters bekomme ich folgenden Fehler
PHP Notice: Undefined property: stdClass::$recommendation in /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Datacenters/Datacenter.php on line 85
$hetznerClient = new HetznerAPIClient($user->hetzner_api_token);
$datacenterClient = new Datacenters();
$hetzner_datacenters = $datacenterClient->all();
[EDIT]
Ich habe mir kurz den Code sowie die Hetzner API Docs angeschaut. Das Object "datacenter" in der Hetzner API Antwort enthält kein Property "recommendation". Dieses Property existiert nur im Object "datacenters". An dieser Stelle müsste dein Code geupdatet werden.
Hi dears, I hope you are having a good day. It seems there is no "get all actions for a server" in server methods.
Can you just implement this function, please?
Hetzner's documentation:
https://docs.hetzner.cloud/#server-actions-get-all-actions-for-a-server
Greetings, fire here!
@LKaemmerling recently invited @fire-bot to this repository. Before fire is enabled, @LKaemmerling needs to complete a few steps:
Only @LKaemmerling will be able to enable fire using the above link. If someone added fire by mistake, feel free to remove @fire-bot from your repo's collaborators.
After upgrading to Symfony 7.0, I'm getting:
Fatal error: Type of Tightenco\Collect\Support\Debug\HtmlDumper::$styles must be array (as in class Symfony\Component\VarDumper\Dumper\CliDumper) in vendor/tightenco/collect/src/Collect/Support/Debug/HtmlDumper.php
on line 7
This is probably due to Symfony's more restrictive type handling in v7.
I was able to fix it by adding array
at https://github.com/tighten/collect/blob/laravel-5.6-ongoing/src/Collect/Support/Debug/HtmlDumper.php#L14 :
protected array $styles = [
So either upgrading or removing tightenco/collect
(as I already suggested at #79) is more urgent now :-)
Sent by Lukas Kämmerling ([email protected]). Created by fire.
I have a problem and want to test this.
I have this code:
$hetznerClient = new HetznerAPIClient($apiKey);
try {
$floatingIps = $hetznerClient->floatingIps()->all();
} catch (Exception $exception) {
echo 'Failed to fetch floating IPs: ' . $exception->getCode();
exit(1);
}
However, I receive this error code:
Stack trace:
#0 /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php(269): LKDev\HetznerCloud\Models\FloatingIps\FloatingIp->__construct(181765, NULL, 'x.x.x.x', 'ipv4', 3387136, Array, Object(LKDev\HetznerCloud\Models\Locations\Location), false, Object(LKDev\HetznerCloud\Models\Protection), Array, '2020-01-31T08:0...', 'ivr-2')
#1 /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php(114): LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::parse(Object(stdClass))
#2 [internal function]: LKD in /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php on line 98
Fatal error: Uncaught TypeError: Argument 2 passed to LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::__construct() must be of the type string, null given, called in /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php on line 269 and defined in /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php on line 98
TypeError: Argument 2 passed to LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::__construct() must be of the type string, null given, called in /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php on line 269 in /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php on line 98
Call Stack:
0.0007 424296 1. {main}() /Users/teye/workspace/ansible/environments/production/hetzner.php:0
0.0101 1506272 2. processKey() /Users/teye/workspace/ansible/environments/production/hetzner.php:155
0.0162 2161616 3. LKDev\HetznerCloud\Models\FloatingIps\FloatingIps->all() /Users/teye/workspace/ansible/environments/production/hetzner.php:56
0.1844 2515656 4. LKDev\HetznerCloud\Models\FloatingIps\FloatingIps::parse() /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php:39
0.1844 2515736 5. LKDev\HetznerCloud\Models\FloatingIps\FloatingIps->setAdditionalData() /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php:126
0.1844 2516136 6. Tightenco\Collect\Support\Collection->map() /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php:115
0.1844 2516512 7. array_map() /Users/teye/workspace/ansible/vendor/tightenco/collect/src/Collect/Support/Collection.php:861
0.1844 2516608 8. LKDev\HetznerCloud\Models\FloatingIps\FloatingIps->LKDev\HetznerCloud\Models\FloatingIps\{closure:/Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php:113-115}() /Users/teye/workspace/ansible/vendor/tightenco/collect/src/Collect/Support/Collection.php:861
0.1847 2543576 9. LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::parse() /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php:114
0.1850 2566048 10. LKDev\HetznerCloud\Models\FloatingIps\FloatingIp->__construct() /Users/teye/workspace/ansible/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php:269
It seems that the class vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php
forces the description to be a string, however, from the json response it can be null:
{
"floating_ips": [
{
"id": xxxx,
"name": "floating-1",
"description": null,
"ip": "x.x.x.x",
"type": "ipv4",
"server": 1234,
"dns_ptr": "..."
}]
}
Changing the descriptions type to ?string
solves the issue. In this way the description can also be null
.
Hi I see this issue when i using SDK
in lkdevelopment/hetzner-cloud-php-sdk/src/Models/Servers/Servers.php
line 240
if (! empty($firewalls)) {
$parameters['firewalls'] = json_encode($firewalls);
}
must remove json_encode see https://docs.hetzner.cloud/#servers-create-a-server
thanks also will be good if you add anther options
Hello. According to the documentation, a volume should have a status
property but the Volume
model does not have it. Could you add it? If needed, I can open a PR. Thanks :)
Hi there,
when using "images()", the labels of each image will not be populated.
In Models/Images/Image.php:231 you do not call the constructor with the last param:
return new self($input->id, $input->type, (property_exists($input, 'status') ? $input->status : null), $input->name, $input->description, $input->image_size, $input->disk_size, $input->created, $input->created_from, $input->bound_to, $input->os_flavor, $input->os_version, $input->rapid_deploy, Protection::parse($input->protection));
As you can see from the constructor, the fifteenth param ($labels) is missing:
public function __construct( int $id, string $type = null, string $status = null, string $name = null, string $description = null, float $imageSize = null, int $diskSize = null, string $created = null, $createdFrom = null, int $boundTo = null, string $osFlavor = null, string $osVersion = null, bool $rapidDeploy = null, Protection $protection = null, array $labels = [] )
As you are parsing the "input" variable from the json as an object and the constructor wants to have a plain array for the labels, you will have to somehow transform the "$input->labels" from stdclass to array. I did a quick hotfix for this (not nice, but works. :) ):
return new self($input->id, $input->type, (property_exists($input, 'status') ? $input->status : null), $input->name, $input->description, $input->image_size, $input->disk_size, $input->created, $input->created_from, $input->bound_to, $input->os_flavor, $input->os_version, $input->rapid_deploy, Protection::parse($input->protection), json_decode(json_encode($input->labels),1));
Would you add a fix in your repo?
And: Thanks a lot for your work on this module!
Experiencing this from a few days:
WARNING: Notice: Undefined property: stdClass::$description {"exception":"[object] (ErrorException(code: 0): Notice: Undefined property: stdClass::$description at /opt/hetzner-ha/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php:308)"}
Probably a change in hetzner API?
Hi:
The serverType object seem to be missing the architecture element. This is needed to distinguish between ARM and X86 servers. It's in the REST API docs but not seem to be exposed in this PHP API wrapper.
Would be great if this script could also handle describe commands :)
hcloud server describe NAME
hcloud floating-ip describe NAME
getByName could utilize it
Currently models (Network, Subnet) expect to receive GuzzleClient class, which is just used to setup Guzzle\Client using construct. It doesn't have any additional method.
It's making it impossible to use own implementation of a client.
In my case I wanted to add Client which doesn't throw on http_errors:
$this->apiClient->setHttpClient(new Client([
'base_uri' => $this->apiClient->getBaseUrl(),
**'http_errors' => false,**
'headers' => [
'Authorization' => 'Bearer ' . $this->apiClient->getApiToken(),
'Content-Type' => 'application/json',
'User-Agent' => ((strlen($this->apiClient->getUserAgent()) > 0) ? $this->apiClient->getUserAgent() . ' ' : '') . 'hcloud-php/' . HetznerAPIClient::VERSION,
],
]));
Unfortunately it will fail:
In Subnet.php line 53:
Argument 2 passed to LKDev\HetznerCloud\Models\Networks\Subnet::parse() must be an instance of LKDev\HetznerCloud\Clients\GuzzleClient or null, instance of GuzzleHttp\Client given, called in X\vendor\lkdevelopment\hetzner-cloud-php-sdk\src\Models\Networks\Network.php on line 177
Output of PHPStan check with level 0: https://phpstan.org/user-guide/rule-levels
basic checks, unknown classes, unknown functions, unknown methods called on $this, wrong number of arguments passed to those methods and functions, always undefined variables
------ -----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Actions/Action.php
------ -----------------------------------------------------------------------------------
94 Method LKDev\HetznerCloud\Models\Actions\Action::getById() should
return LKDev\HetznerCloud\Models\Actions\Action but return statement
is missing.
------ -----------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Actions/ActionRequestOpts.php
------ ----------------------------------------------------------------------------------------------
33 Access to an undefined property
LKDev\HetznerCloud\Models\Datacenters\ActionRequestOpts::$sort.
------ ----------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Actions/Actions.php
------ ------------------------------------------------------------------------------------
43 Method LKDev\HetznerCloud\Models\Actions\Actions::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
61 Method LKDev\HetznerCloud\Models\Actions\Actions::getById() should
return LKDev\HetznerCloud\Models\Actions\Action but return statement
is missing.
------ ------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Datacenters/Datacenters.php
------ --------------------------------------------------------------------------------------------
62 Method LKDev\HetznerCloud\Models\Datacenters\Datacenters::list()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
83 Method LKDev\HetznerCloud\Models\Datacenters\Datacenters::getById()
should return LKDev\HetznerCloud\Models\Datacenters\Datacenter but
return statement is missing.
------ --------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIp.php
------ -------------------------------------------------------------------------------------------
138 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::update()
should return
static(LKDev\HetznerCloud\Models\FloatingIps\FloatingIp) but return
statement is missing.
167 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::delete()
should return bool but return statement is missing.
187 Method
LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::changeProtection()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
209 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::assignTo()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
226 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::unassign()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
250 Method
LKDev\HetznerCloud\Models\FloatingIps\FloatingIp::changeReverseDNS()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ -------------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/FloatingIps/FloatingIps.php
------ --------------------------------------------------------------------------------------------
60 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIps::list()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
81 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIps::getById()
should return LKDev\HetznerCloud\Models\FloatingIps\FloatingIp but
return statement is missing.
127 Method LKDev\HetznerCloud\Models\FloatingIps\FloatingIps::create()
should return LKDev\HetznerCloud\Models\FloatingIps\FloatingIp but
return statement is missing.
------ --------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/ISOs/ISOs.php
------ ------------------------------------------------------------------------------
58 Method LKDev\HetznerCloud\Models\ISOs\ISOs::list() should return
LKDev\HetznerCloud\APIResponse but return statement is missing.
79 Method LKDev\HetznerCloud\Models\ISOs\ISOs::getById() should return
LKDev\HetznerCloud\Models\ISOs\ISO but return statement is missing.
------ ------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Images/Image.php
------ ---------------------------------------------------------------------------------
162 Method LKDev\HetznerCloud\Models\Images\Image::update() should return
LKDev\HetznerCloud\Models\Images\Image but return statement is
missing.
182 Method LKDev\HetznerCloud\Models\Images\Image::changeProtection()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
199 Method LKDev\HetznerCloud\Models\Images\Image::delete() should return
bool but return statement is missing.
------ ---------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Images/Images.php
------ ----------------------------------------------------------------------------------
55 Method LKDev\HetznerCloud\Models\Images\Images::list() should return
LKDev\HetznerCloud\APIResponse but return statement is missing.
76 Method LKDev\HetznerCloud\Models\Images\Images::getById() should
return LKDev\HetznerCloud\Models\Images\Image but return statement is
missing.
------ ----------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Locations/Locations.php
------ ----------------------------------------------------------------------------------------
58 Method LKDev\HetznerCloud\Models\Locations\Locations::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
79 Method LKDev\HetznerCloud\Models\Locations\Locations::getById()
should return LKDev\HetznerCloud\Models\Locations\Location but return
statement is missing.
------ ----------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Networks/Network.php
------ -------------------------------------------------------------------------------------
162 Method LKDev\HetznerCloud\Models\Networks\Network::changeProtection()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ -------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Networks/Networks.php
------ --------------------------------------------------------------------------------------
55 Method LKDev\HetznerCloud\Models\Networks\Networks::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
76 Method LKDev\HetznerCloud\Models\Networks\Networks::getById() should
return LKDev\HetznerCloud\Models\Networks\Network but return
statement is missing.
------ --------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Prices/Prices.php
------ ----------------------------------------------------------------------------------
39 Method LKDev\HetznerCloud\Models\Prices\Prices::all() should return
stdClass but return statement is missing.
------ ----------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/SSHKeys/SSHKey.php
------ -----------------------------------------------------------------------------------
75 Method LKDev\HetznerCloud\Models\SSHKeys\SSHKey::update() should
return LKDev\HetznerCloud\Models\SSHKeys\SSHKey but return statement
is missing.
104 Method LKDev\HetznerCloud\Models\SSHKeys\SSHKey::delete() should
return bool but return statement is missing.
------ -----------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/SSHKeys/SSHKeys.php
------ ------------------------------------------------------------------------------------
46 Method LKDev\HetznerCloud\Models\SSHKeys\SSHKeys::create() should
return LKDev\HetznerCloud\Models\SSHKeys\SSHKey but return statement
is missing.
82 Method LKDev\HetznerCloud\Models\SSHKeys\SSHKeys::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ ------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Servers/Server.php
------ -----------------------------------------------------------------------------------
190 Method LKDev\HetznerCloud\Models\Servers\Server::powerOn() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
207 Method LKDev\HetznerCloud\Models\Servers\Server::softReboot() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
224 Method LKDev\HetznerCloud\Models\Servers\Server::reset() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
241 Method LKDev\HetznerCloud\Models\Servers\Server::shutdown() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
258 Method LKDev\HetznerCloud\Models\Servers\Server::powerOff() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
275 Method LKDev\HetznerCloud\Models\Servers\Server::resetRootPassword()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
302 Method LKDev\HetznerCloud\Models\Servers\Server::enableRescue()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
322 Method LKDev\HetznerCloud\Models\Servers\Server::disableRescue()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
348 Method LKDev\HetznerCloud\Models\Servers\Server::createImage() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
373 Method LKDev\HetznerCloud\Models\Servers\Server::rebuildFromImage()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
399 Method LKDev\HetznerCloud\Models\Servers\Server::changeType() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
416 Method LKDev\HetznerCloud\Models\Servers\Server::enableBackups()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
433 Method LKDev\HetznerCloud\Models\Servers\Server::disableBackups()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
455 Method LKDev\HetznerCloud\Models\Servers\Server::attachISO() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
472 Method LKDev\HetznerCloud\Models\Servers\Server::detachISO() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
496 Method LKDev\HetznerCloud\Models\Servers\Server::changeReverseDNS()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
534 Method LKDev\HetznerCloud\Models\Servers\Server::delete() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
571 Method LKDev\HetznerCloud\Models\Servers\Server::requestConsole()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
599 Method LKDev\HetznerCloud\Models\Servers\Server::changeProtection()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ -----------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Servers/Servers.php
------ ------------------------------------------------------------------------------------
62 Method LKDev\HetznerCloud\Models\Servers\Servers::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
98 Method LKDev\HetznerCloud\Models\Servers\Servers::getById() should
return LKDev\HetznerCloud\Models\Servers\Server but return statement
is missing.
147 Method
LKDev\HetznerCloud\Models\Servers\Servers::createInDatacenter()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
203 Method LKDev\HetznerCloud\Models\Servers\Servers::createInLocation()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ ------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Servers/Types/ServerTypes.php
------ ----------------------------------------------------------------------------------------------
52 Method LKDev\HetznerCloud\Models\Servers\Types\ServerTypes::list()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ ----------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Volumes/Volume.php
------ -----------------------------------------------------------------------------------
104 Method LKDev\HetznerCloud\Models\Volumes\Volume::delete() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
196 Method LKDev\HetznerCloud\Models\Volumes\Volume::changeProtection()
should return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ -----------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Volumes/Volumes.php
------ ------------------------------------------------------------------------------------
64 Method LKDev\HetznerCloud\Models\Volumes\Volumes::list() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
100 Method LKDev\HetznerCloud\Models\Volumes\Volumes::getById() should
return LKDev\HetznerCloud\Models\Volumes\Volume but return statement
is missing.
135 Method LKDev\HetznerCloud\Models\Volumes\Volumes::create() should
return LKDev\HetznerCloud\APIResponse but return statement is
missing.
------ ------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Actions/ActionsTest.php
------ -----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -----------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Datacenters/DatacentersTest.php
------ -------------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -------------------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/FloatingIPs/FloatingIPsTest.php
------ -------------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
21 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -------------------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/FloatingIPs/FloatingIpTest.php
------ ------------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
24 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/ISO/ISOsTest.php
------ ----------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ----------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Images/ImagesTest.php
------ ---------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ---------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Locations/LocationsTest.php
------ ---------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ---------------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Networks/NetworkTest.php
------ ------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
16 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Networks/NetworksTest.php
------ -------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
22 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -------------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Pricing/PricingTest.php
------ -----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -----------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/SSHKeys/SSHKeysTest.php
------ -----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -----------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/ServerTypes/ServerTypesTest.php
------ -------------------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -------------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Servers/ServerTest.php
------ ----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
24 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ----------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Servers/ServersTest.php
------ -----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
19 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -----------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Volumes/VolumeTest.php
------ ----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
15 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ----------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Integration/Volumes/VolumesTest.php
------ -----------------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
14 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -----------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/TestCase.php
------ ------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
18 Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Unit/ApiResponseTest.php
------ ------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Unit/BasicClientTest.php
------ ------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line includes/vendor/lkdevelopment/hetzner-cloud-php-sdk/tests/Unit/RequestOptsTest.php
------ ------------------------------------------------------------------------------------
Reflection error: PHPUnit\Framework\TestCase not found.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ------------------------------------------------------------------------------------
Hi there,
Thanks for this awesome package!
I have a slight problem to get the websocket url and password from the package.
In the code i execute:
$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient(getenv('HCLOUD_TOKEN'));
$server = (new \LKDev\HetznerCloud\Models\Servers\Servers())->get(xxxxx);
var_dump($server->requestConsole());
I expected to get a wss_url
and password
but instead i'm only getting:
LKDev\HetznerCloud\Models\Actions\Action {#1613
+id: xxxxx,
+command: "request_console",
+progress: 100,
+started: "success",
+finished: "2018-04-22T09:22:39+00:00",
+resources: "2018-04-22T09:22:39+00:00",
+error: [
{#1557
+"id": xxxxx,
+"type": "server",
},
],
+root_password: null,
}
Can you help me out for a bit with this?
Thanks in advance
Ramon
This can't be meant how it's to be used is it?
$lb = $hetznerClient->loadBalancers()->getByName('...');
foreach($lb->targets as $target) {
$ip = new LoadBalancerTargetIp($target->ip->ip);
$lb->removeTarget('ip', $ip);
}
Same for addTarget
How I expected it to work;
$lb = $hetznerClient->loadBalancers()->getByName('...');
foreach($lb->targets as $target) {
$lb->removeTarget($target);
# or maybe, or make it smart and work with $target only aswell
$lb->removeTargetByIp($target->ip);
}
Also missing a removeTargets($targets);
Hallo,
die Methode "create" der Klasse \LKDev\HetznerCloud\Models\Servers\Servers ist nicht funktionsfähig, da sie sowohl location als auch datacenter im Request an die Hetzner-API übergibt. Die dahinterliegende API gibt aber folgenden Fehler zurück:
"error": {
"message": "invalid input in fields 'datacenter', 'location'",
"code": "invalid_input",
"details": {
"fields": [
{
"name": "datacenter",
"messages": [
"location and datacenter are mutually exclusive"
]
},
{
"name": "location",
"messages": [
"location and datacenter are mutually exclusive"
]
}
]
}
}
}```
The function getByName() in the images model always returns the first value which is usually the x86 image.
Since you can now get two images from the same name (one for arm and one for x86), one of two things might need to be changed:
Maybe both needs to be done?
OR, the image names need to be changed - eg: 'ubuntu-22.04' and 'ubuntu-22.04-arm' but that would have to be done by Hetzner's ops team. So likely more practical to implement one or both the options above?
with the release of the Arm64 servers, getByName() on images now fails and reports that there are several architectures for this image.
Some way to specify the architecture required would be helpful.
Hi, do you plan add support for the new feature released by Hetzner Cloud API?
Reference: https://docs.hetzner.cloud/#primary-ips
I developed a Module and use the function $server->resetRootPassword();.
How to Print the Password?
Hello,
I have a Laravel 7 an and I use the new HTTP Client from Laravel 7 (https://laravel.com/docs/7.x/http-client).
When I try to install your package via composer I get an error because of the already existing Guzzle:
Problem 1
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- Can only install one of: guzzlehttp/guzzle[7.0.1, 6.5.x-dev].
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- lkdevelopment/hetzner-cloud-php-sdk v2.2.0 requires guzzlehttp/guzzle ^6.3 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- Installation request for lkdevelopment/hetzner-cloud-php-sdk ^2.2 -> satisfiable by lkdevelopment/hetzner-cloud-php-sdk[v2.2.0].
- Installation request for guzzlehttp/guzzle (locked at 7.0.1, required as ^7.0) -> satisfiable by guzzlehttp/guzzle[7.0.1].
Is there any way to make this work?
At the moment, the all
Methods are quite confusing, as they imply that you will get all servers.
The all method should be able to retrieve really all
servers instead of just the first page....
Hi,
I have 41 servers in cloud.
If I try get informations with $hetznerClient->servers()->all() method then get only 25.
Can you help me?
Thank you!
$created field is missed https://github.com/LKDevelopment/hetzner-cloud-php-sdk/blob/master/src/Models/Servers/Server.php#L44 in https://github.com/LKDevelopment/hetzner-cloud-php-sdk/blob/master/src/Models/Servers/Server.php#L131
must be added:
$this->created = $data->created;
Would be great to have a firewalls
parameter for createInDatacenter
and createInLocation
.
der code:
$server->createImage('testimage'));
führt bei hetzner zu den fehler: invalid input in field 'labels'
es scheint der default für die labels als leeres array schuld zu sein. das wird beim post request zu einen "labels":[] laut api doku ist aber nur ein leeres assoziatives array zulässig, also ein "labels": {}
Error description:
Package tightenco/collect is abandoned, you should avoid using it. Use illuminate/collections instead.
I'd love to push a PR, considering all the PR's made by the community being left open I start with an issue. If you want me to PR this, please let me know.
you should change this code:
return APIResponse::create([
'action' => Action::parse(json_decode((string)$response->getBody())->action)
], $response->getHeaders());
on this:
$payload = json_decode((string)$response->getBody());
return APIResponse::create(array_merge([
'action' => Action::parse($payload->action),
], (property_exists($payload, 'root_password')) ? ['root_password' => $payload->root_password] : []
), $response->getHeaders());
Hallo,
ich versuche auf nem Server mit Ubuntu 18.04, Apache2 und php 7.2 einen Server zu erstellen mit dem example script und bekomme leider folgende Fehlermeldung die mich völlig ratlos zurück lässt.
Denn alle anderen examples funktionieren wunderbar.
PHP Fatal error: Uncaught TypeError: Argument 1 passed to LKDev\HetznerCloud\Models\Locations\Locations::all() must be an instance of LKDev\HetznerCloud\RequestOpts or null, string given, called in /home/tom/hetzner_test_php/hetzner_server_erstellen.php on line 10 and defined in /home/tom/hetzner_test_php/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Locations/Locations.php:35 Stack trace: #0 /home/tom/hetzner_test_php/hetzner_server_erstellen.php(10): LKDev\HetznerCloud\Models\Locations\Locations->all('fsn1') #1 {main} thrown in /home/tom/hetzner_test_php/vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Locations/Locations.php on line 35
Kann sich jemand erklären wie das Zustande kommt?
Danke! :)
Extending Guzzle\Client is deprecated since Guzzle 7.1 and the class is annotated as @Final. The class will be actually final in Guzzle 8.0.
I would like to have the size of the attached volume, but only get the volumeid.
Is this function not yet available?
$firewall = $this->client->firewalls()->getByName('name');
I'm receiving the following error when retrieving a Firewall which has a rule with an "any" port:
PHP Fatal error: Uncaught TypeError: Argument 5 passed to LKDev\HetznerCloud\Models\Firewalls\FirewallRule::__construct() must be of the type string, null given, called in /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Firewalls/Firewall.php on line 112 and defined in /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Firewalls/FirewallRule.php:48 Stack trace: #0 /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Firewalls/Firewall.php(112): LKDev\HetznerCloud\Models\Firewalls\FirewallRule->__construct('in', 'icmp', Array, Array, NULL) #1 /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Firewalls/Firewalls.php(129): LKDev\HetznerCloud\Models\Firewalls\Firewall::parse(Object(stdClass)) #2 [internal function]: LKDev\HetznerCloud\Models\Firewalls\Firewalls->LKDev\HetznerCloud\Models\Firewalls\{closure}(Object(stdClass), 0) #3 /vendor/tightenco/collect/src/Collect/Support/Collection.ph in /vendor/lkdevelopment/hetzner-cloud-php-sdk/src/Models/Firewalls/FirewallRule.php on line 48
The issue should be easy to resolve adding null to the $port parameter type casting in FirewallRule.
We should have unit tests for all endpoints.
We could use travis ci for this.
The last line of the getByName()
method returns null
if the image does not exist. But null
is not allowed by the method's return type.
Images.php:
public function getByName(string $name): Image
{
$images = $this->list(new ImageRequestOpts($name));
return (count($images->images) > 0) ? $images->images[0] : null;
}
$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient(
$key,
'https://api.hetzner.cloud/v1/',
'ploi.io/1.0.0'
);
If the URL would ever change, I would have to manually change this in my source, because I have a custom agent passed in. Would be nice if there would be 2 additional methods:
Set URL:
$hetznerClient->setApiUrl('http://...')
Set User Agent:
$hetznerClient->setUserAgent('ploi.io/1.0.0')
Client instantiator:
$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient($key);
Total picture:
$hetznerClient = new \LKDev\HetznerCloud\HetznerAPIClient($key);
$hetznerClient->setApiUrl('http://...');
$hetznerClient->setUserAgent('ploi.io/1.0.0')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.