NAME
Net::Async::Hetzner::Cloud - Async Hetzner Cloud API client for IO::Async
VERSION
version 0.003
SYNOPSIS
use IO::Async::Loop;
use Net::Async::Hetzner::Cloud;
my $loop = IO::Async::Loop->new;
my $cloud = Net::Async::Hetzner::Cloud->new(
token => $ENV{HETZNER_API_TOKEN},
);
$loop->add($cloud);
# List servers
my $data = $cloud->get('/servers')->get;
for my $server (@{ $data->{servers} }) {
printf "%s (%s)\n", $server->{name}, $server->{status};
}
# Create server (non-blocking)
$cloud->post('/servers', {
name => 'my-server',
server_type => 'cx22',
image => 'debian-12',
location => 'fsn1',
})->then(sub {
my ($data) = @_;
print "Created: $data->{server}{id}\n";
return Future->done;
})->get;
# Parallel requests
my @futures = map {
$cloud->get("/servers/$_")
} @server_ids;
my @results = Future->wait_all(@futures)->get;
DESCRIPTION
Async client for the Hetzner Cloud API built on IO::Async. Extends IO::Async::Notifier and uses Net::Async::HTTP for non-blocking HTTP communication.
All methods return Future objects. Request building and response parsing are delegated to WWW::Hetzner::Cloud.
token
Hetzner Cloud API token. Falls back to HETZNER_API_TOKEN environment variable.
base_url
Base URL for the Cloud API. Defaults to https://api.hetzner.cloud/v1.
get($path, %params)
my $f = $cloud->get('/servers', params => { label_selector => 'env=prod' });
Async GET request. Returns a Future that resolves to the parsed JSON response data.
post($path, \%body)
my $f = $cloud->post('/servers', { name => 'test', ... });
Async POST request with JSON body.
put($path, \%body)
my $f = $cloud->put('/servers/123', { name => 'renamed' });
Async PUT request with JSON body.
delete($path)
my $f = $cloud->delete('/servers/123');
Async DELETE request.
SEE ALSO
Net::Async::Hetzner, Net::Async::Hetzner::Robot, WWW::Hetzner::Cloud, IO::Async, Future
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-hetzner/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.