NAME

WWW::Hetzner::Cloud::Server - Hetzner Cloud Server object

VERSION

version 0.002

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";

# 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');

# Delete
$server->delete;

DESCRIPTION

This class represents a Hetzner Cloud server. Objects are returned by WWW::Hetzner::Cloud::API::Servers methods.

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.

ipv6

Public IPv6 network.

server_type

Server type name, e.g. "cx22".

datacenter

Datacenter name.

location

Location name.

image

Image name.

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).

reboot

$server->reboot;

Hard reboot.

shutdown

$server->shutdown;

Graceful shutdown via ACPI.

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

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-hetzner/issues.

IRC

Join #kubernetes on irc.perl.org or message Getty directly.

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.