NAME

WWW::Hetzner::Cloud::API::Networks - Hetzner Cloud Networks API

VERSION

version 0.002

SYNOPSIS

my $cloud = WWW::Hetzner::Cloud->new(token => $token);

# List networks
my $networks = $cloud->networks->list;

# Create network
my $network = $cloud->networks->create(
    name     => 'my-network',
    ip_range => '10.0.0.0/8',
);

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

# Add route
$cloud->networks->add_route($network->id,
    destination => '10.100.1.0/24',
    gateway     => '10.0.0.1',
);

# Delete
$cloud->networks->delete($network->id);

DESCRIPTION

This module provides the API for managing Hetzner Cloud networks. All methods return WWW::Hetzner::Cloud::Network objects.

list

my $networks = $cloud->networks->list;
my $networks = $cloud->networks->list(label_selector => 'env=prod');

Returns arrayref of WWW::Hetzner::Cloud::Network objects.

get

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

Returns WWW::Hetzner::Cloud::Network object.

create

my $network = $cloud->networks->create(
    name     => 'my-network',  # required
    ip_range => '10.0.0.0/8',  # required
    labels   => { ... },       # optional
    subnets  => [ ... ],       # optional
    routes   => [ ... ],       # optional
);

Creates network. Returns WWW::Hetzner::Cloud::Network object.

update

$cloud->networks->update($id, name => 'new-name', labels => { ... });

Updates network. Returns WWW::Hetzner::Cloud::Network object.

delete

$cloud->networks->delete($id);

Deletes network.

add_subnet

$cloud->networks->add_subnet($id,
    ip_range     => '10.0.1.0/24',
    network_zone => 'eu-central',
    type         => 'cloud',
    vswitch_id   => $id,  # optional, for vswitch type
);

Add a subnet to the network.

delete_subnet

$cloud->networks->delete_subnet($id, $ip_range);

Delete a subnet from the network.

add_route

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

Add a route to the network.

delete_route

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

Delete a route from the network.

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.