NAME
WWW::Hetzner::Cloud::LoadBalancer - Hetzner Cloud Load Balancer object
VERSION
version 0.002
SYNOPSIS
my $lb = $cloud->load_balancers->get($id);
# Read attributes
print $lb->name, "\n";
print $lb->ipv4, "\n";
# Add target
$lb->add_target(type => 'server', server => { id => 123 });
# Add service
$lb->add_service(
protocol => 'http',
listen_port => 80,
destination_port => 8080,
);
# Delete
$lb->delete;
DESCRIPTION
This class represents a Hetzner Cloud load balancer. Objects are returned by WWW::Hetzner::Cloud::API::LoadBalancers methods.
id
Load balancer ID (read-only).
name
Load balancer name (read-write).
public_net
Public network configuration hash (read-only).
private_net
Arrayref of private network attachments (read-only).
location
Location data hash (read-only).
load_balancer_type
Load balancer type data hash (read-only).
protection
Protection settings hash (read-only).
labels
Labels hash (read-write).
targets
Arrayref of targets (read-only).
services
Arrayref of services (read-only).
algorithm
Algorithm configuration hash (read-only).
created
Creation timestamp (read-only).
outgoing_traffic
Outgoing traffic in bytes (read-only).
ingoing_traffic
Ingoing traffic in bytes (read-only).
included_traffic
Included traffic in bytes (read-only).
location_name
Returns location name.
type_name
Returns load balancer type name.
ipv4
Returns public IPv4 address.
ipv6
Returns public IPv6 address.
update
$lb->name('new-name');
$lb->update;
Saves changes to name and labels.
delete
$lb->delete;
Deletes the load balancer.
add_target
$lb->add_target(type => 'server', server => { id => 123 });
Add a target to the load balancer.
remove_target
$lb->remove_target(type => 'server', server => { id => 123 });
Remove a target from the load balancer.
add_service
$lb->add_service(
protocol => 'http',
listen_port => 80,
destination_port => 8080,
);
Add a service to the load balancer.
delete_service
$lb->delete_service(80);
Delete a service by listen port.
attach_to_network
$lb->attach_to_network($network_id);
$lb->attach_to_network($network_id, ip => '10.0.0.5');
Attach load balancer to a network.
detach_from_network
$lb->detach_from_network($network_id);
Detach load balancer from a network.
refresh
$lb->refresh;
Reloads load balancer data from the API.
data
my $hashref = $lb->data;
Returns all load balancer 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.