NAME
WWW::Hetzner::Cloud::Server - Hetzner Cloud Server object
VERSION
version 0.001
SYNOPSIS
my $server = $cloud->servers->get($id);
# Read attributes
print $server->id, "\n";
print $server->name, "\n";
print $server->status, "\n";
print $server->ipv4, "\n";
print $server->ipv6, "\n";
# Check status
if ($server->is_running) { ... }
if ($server->is_off) { ... }
# Update
$server->name('new-name');
$server->labels({ env => 'prod' });
$server->update;
# Power actions
$server->shutdown;
$server->power_on;
$server->power_off;
$server->reboot;
# Rebuild with new image
$server->rebuild('debian-13');
# Refresh data from API
$server->refresh;
# Delete
$server->delete;
DESCRIPTION
This class represents a Hetzner Cloud server. Objects are returned by WWW::Hetzner::Cloud::API::Servers methods.
NAME
WWW::Hetzner::Cloud::Server - Hetzner Cloud Server object
ATTRIBUTES
id
Server ID (read-only).
name
Server name (read-write).
status
Server status: running, off, starting, stopping, etc. (read-only).
locked
Whether the server is locked (read-only).
created
Creation timestamp (read-only).
labels
Labels hash (read-write).
ipv4
Public IPv4 address (read-only, convenience accessor).
ipv6
Public IPv6 network (read-only, convenience accessor).
server_type
Server type name, e.g. "cx22" (read-only, convenience accessor).
datacenter
Datacenter name (read-only, convenience accessor).
location
Location name (read-only, convenience accessor).
image
Image name (read-only, convenience accessor).
METHODS
is_running
if ($server->is_running) { ... }
Returns true if server status is "running".
is_off
if ($server->is_off) { ... }
Returns true if server status is "off".
update
$server->name('new-name');
$server->update;
Saves changes to name and labels back to the API.
delete
$server->delete;
Deletes the server.
power_on
$server->power_on;
Powers on the server.
power_off
$server->power_off;
Hard power off (like pulling the power cord).
shutdown
$server->shutdown;
Graceful shutdown via ACPI.
reboot
$server->reboot;
Hard reboot.
rebuild
$server->rebuild('debian-13');
Rebuilds the server with a new image. Data will be lost.
refresh
$server->refresh;
Reloads server data from the API.
data
my $hashref = $server->data;
Returns all server data as a hashref (for JSON serialization).
SUPPORT
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/Getty/p5-www-hetzner
git clone https://github.com/Getty/p5-www-hetzner.git
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.