Skip to content

Commit bd68629

Browse files
committed
Fix create_server sample and readme
1 parent f9c030a commit bd68629

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ If you discover any security related issues, please email kontakt@lukas-kaemmerl
4343

4444
## Credits
4545

46-
- [Lukas Kämmerling](https://github.com/lkdevelopment)
46+
- [Lukas Kämmerling](https://github.com/lkaemmerling)
4747
- [All Contributors](../../contributors)
4848

4949
## License
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

3-
require_once __DIR__.'/../bootstrap.php';
3+
require_once __DIR__ . '/../bootstrap.php';
44

55
$serverType = $hetznerClient->serverTypes()->get(1);
6-
$location = $hetznerClient->locations()->all('fsn1')[0];
7-
$image = $hetznerClient->images()->all('ubuntu-18.04')[0];
6+
$location = $hetznerClient->locations()->getByName("fsn1");
7+
$image = $hetznerClient->images()->getByName("ubuntu-20.04");
88
$apiResponse = $hetznerClient->servers()->createInLocation('my-example-server.test', $serverType, $image, $location);
99
$server = $apiResponse->getResponsePart('server');
1010
$action = $apiResponse->getResponsePart('action');
11-
echo 'Server: '.$server->name.PHP_EOL;
12-
echo 'IP: '.$server->publicNet->ipv4->ip.PHP_EOL;
13-
echo 'Password: '.$apiResponse->getResponsePart('root_password').PHP_EOL;
14-
echo 'Now we wait on the success of the server creation!'.PHP_EOL;
15-
echo date('H:i:s').PHP_EOL;
16-
\LKDev\HetznerCloud\Models\Actions\Actions::waitActionCompleted($action);
17-
echo date('H:i:s').PHP_EOL;
11+
echo 'Server: ' . $server->name . PHP_EOL;
12+
echo 'IP: ' . $server->publicNet->ipv4->ip . PHP_EOL;
13+
echo 'Password: ' . $apiResponse->getResponsePart('root_password') . PHP_EOL;
14+
echo 'Now we wait on the success of the server creation!' . PHP_EOL;
15+
echo date('H:i:s') . PHP_EOL;
16+
$action->waitUntilCompleted();
17+
echo date('H:i:s') . PHP_EOL;
1818
echo 'Done!';

0 commit comments

Comments
 (0)