NAME

WWW::Hetzner::Cloud::Network - Hetzner Cloud Network object

VERSION

version 0.002

SYNOPSIS

my $network = $cloud->networks->get($id);

# Read attributes
print $network->name, "\n";
print $network->ip_range, "\n";

# Subnets
$network->add_subnet(
    ip_range     => '10.0.1.0/24',
    network_zone => 'eu-central',
    type         => 'cloud',
);
$network->delete_subnet('10.0.1.0/24');

# Routes
$network->add_route(destination => '10.100.1.0/24', gateway => '10.0.0.1');
$network->delete_route(destination => '10.100.1.0/24', gateway => '10.0.0.1');

# Update
$network->name('new-name');
$network->update;

# Delete
$network->delete;

DESCRIPTION

This class represents a Hetzner Cloud network. Objects are returned by WWW::Hetzner::Cloud::API::Networks methods.

id

Network ID (read-only).

name

Network name (read-write).

ip_range

Network IP range in CIDR notation (read-only).

subnets

Arrayref of subnet definitions (read-only).

routes

Arrayref of route definitions (read-only).

servers

Arrayref of attached server IDs (read-only).

labels

Labels hash (read-write).

protection

Protection settings hash (read-only).

created

Creation timestamp (read-only).

load_balancers

Arrayref of attached load balancer IDs (read-only).

expose_routes_to_vswitch

Whether routes are exposed to vSwitch (read-only).

update

$network->name('new-name');
$network->update;

Saves changes to name and labels.

delete

$network->delete;

Deletes the network.

add_subnet

$network->add_subnet(
    ip_range     => '10.0.1.0/24',
    network_zone => 'eu-central',
    type         => 'cloud',
);

Add a subnet. Required: ip_range, network_zone, type.

delete_subnet

$network->delete_subnet('10.0.1.0/24');

Delete a subnet by IP range.

add_route

$network->add_route(destination => '10.100.1.0/24', gateway => '10.0.0.1');

Add a route. Required: destination, gateway.

delete_route

$network->delete_route(destination => '10.100.1.0/24', gateway => '10.0.0.1');

Delete a route. Required: destination, gateway.

refresh

$network->refresh;

Reloads network data from the API.

data

my $hashref = $network->data;

Returns all network 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.