NAME

WWW::Hetzner::Action - Hetzner API action object

VERSION

version 0.101

SYNOPSIS

my $action = $cloud->actions->get($id);

# Read attributes
print $action->id, "\n";
print $action->command, "\n";
print $action->status, "\n";

# Check status
if ($action->is_running) { ... }
if ($action->is_success) { ... }
if ($action->is_error)   { ... }

# Poll once
$action->refresh;

# Block until terminal
$action->wait(interval => 2, timeout => 120);

DESCRIPTION

This class represents an asynchronous Hetzner API action, the job object returned by resource-mutating calls (create, delete, power actions, ...). Objects are returned by API-controller methods that expose actions.

poll_path

Base path used by "refresh" to reload this action (read-only).

id

Action ID (read-only).

command

Action command, e.g. "create_server" (read-only).

status

Action status: running, success, error (read-only).

progress

Progress percentage, 0-100 (read-only).

started

Timestamp the action started (read-only).

finished

Timestamp the action finished, or undef while running (read-only).

resources

Arrayref of resources this action refers to (read-only).

error

Error hashref ({ code, message }) when the action failed, else undef (read-only).

result

Hashref (default {}) of sidecar fields some endpoints return alongside action. See "root_password", "image", "wss_url", and "password" for typed readers over this hash (read-only).

root_password

my $pw = $action->root_password;

Convenience reader for $action->result->{root_password}. Undef when absent.

image

my $image_id = $action->image;

Convenience reader for $action->result->{image}. Undef when absent.

wss_url

my $url = $action->wss_url;

Convenience reader for $action->result->{wss_url}. Undef when absent.

password

my $pw = $action->password;

Convenience reader for $action->result->{password}. Undef when absent.

is_running

if ($action->is_running) { ... }

Returns true if action status is "running".

is_success

if ($action->is_success) { ... }

Returns true if action status is "success".

is_error

if ($action->is_error) { ... }

Returns true if action status is "error".

error_message

my $message = $action->error_message;

Returns error.message when the action failed, else undef.

refresh

$action->refresh;

Reloads status/progress/error from the API via GET $poll_path/$id.

wait

$action->wait(interval => 2, timeout => 120);

Polls (via "refresh") until the action reaches a terminal status, sleeping interval seconds between polls via the client's sleeper. Returns $self on success. Croaks with the API error.message if the action fails, and with the action's id and command if timeout is reached before the action finishes. Does not sleep when the action is already terminal.

data

my $hashref = $action->data;

Returns all action data as a hashref (for JSON serialization).

SEE ALSO

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 <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.