NAME

WWW::Hetzner::Role::HasActions - Controller role wrapping raw hashes as Action objects

VERSION

version 0.101

SYNOPSIS

package WWW::Hetzner::Cloud::API::Servers;
use Moo;
with 'WWW::Hetzner::Role::HasActions';

# inside a method that returns an action
return $self->_wrap_action($result->{action});

DESCRIPTION

Shared helper for API controllers whose endpoints return an action or a list of actions alongside (or instead of) the primary resource. Wraps raw decoded-JSON hashes as WWW::Hetzner::Action objects.

Requires the consumer to provide a client attribute or method.

action_poll_path

Base path used when wrapped Actions are refreshed. Defaults to the Cloud /actions endpoint; controllers for another API host may override it.

_wrap_action

my $action = $self->_wrap_action($hash);

Wraps a decoded action hashref as a WWW::Hetzner::Action. Returns undef when $hash is undef.

_wrap_actions

my $actions = $self->_wrap_actions($arrayref);

Wraps each element of $arrayref via "_wrap_action". Returns an empty arrayref when $arrayref is undef.

_wrap_action_result

my $action = $self->_wrap_action_result($result);

Wraps a full decoded-JSON response hashref as a WWW::Hetzner::Action, same as "_wrap_action", but keeps whatever the endpoint returned alongside action (e.g. root_password) as the Action's "result" in WWW::Hetzner::Action. Returns undef when $result carries no action key.

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.