NAME
WWW::Hetzner::Cloud::API::RRSets - Hetzner Cloud DNS RRSets (Records) API
VERSION
version 0.001
SYNOPSIS
use WWW::Hetzner::Cloud;
my $cloud = WWW::Hetzner::Cloud->new(token => $ENV{HETZNER_API_TOKEN});
# Get RRSets object for a zone
my $rrsets = $cloud->zones->rrsets($zone_id);
# Or from a Zone object
my $zone = $cloud->zones->get($zone_id);
my $rrsets = $zone->rrsets;
# List all records
my $records = $rrsets->list;
my $records = $rrsets->list(type => 'A');
# Get specific record
my $record = $rrsets->get('www', 'A');
printf "Record: %s -> %s\n", $record->name, $record->records->[0]{value};
# Create records
my $record = $rrsets->create(
name => 'www',
type => 'A',
ttl => 300,
records => [{ value => '203.0.113.10' }],
);
# Convenience methods
$rrsets->add_a('www', '203.0.113.10', ttl => 300);
$rrsets->add_aaaa('www', '2001:db8::1');
$rrsets->add_cname('blog', 'www.example.com.');
$rrsets->add_mx('@', 'mail.example.com.', 10);
$rrsets->add_txt('@', 'v=spf1 include:_spf.example.com ~all');
# Update record
$rrsets->update('www', 'A', records => [{ value => '203.0.113.20' }]);
# Delete record
$rrsets->delete('www', 'A');
DESCRIPTION
This module provides access to DNS RRSets (Resource Record Sets) within a zone. RRSets are groups of DNS records with the same name and type. All methods return WWW::Hetzner::Cloud::RRSet objects.
NAME
WWW::Hetzner::Cloud::API::RRSets - Hetzner Cloud DNS RRSets (Records) API
METHODS
list
my $records = $rrsets->list;
my $records = $rrsets->list(type => 'A', name => 'www');
Returns an arrayref of WWW::Hetzner::Cloud::RRSet objects. Optional parameters: name, type, sort, page, per_page.
get
my $record = $rrsets->get($name, $type);
my $record = $rrsets->get('www', 'A');
Returns a WWW::Hetzner::Cloud::RRSet object.
create
my $record = $rrsets->create(
name => 'www', # required
type => 'A', # required
records => [{ value => '1.2.3.4' }], # required
ttl => 300, # optional
);
Creates a new RRSet. Returns a WWW::Hetzner::Cloud::RRSet object.
update
my $record = $rrsets->update('www', 'A',
ttl => 600,
records => [{ value => '1.2.3.5' }],
);
Updates an existing RRSet. Returns a WWW::Hetzner::Cloud::RRSet object.
delete
$rrsets->delete('www', 'A');
Deletes an RRSet.
CONVENIENCE METHODS
add_a
my $record = $rrsets->add_a('www', '203.0.113.10', ttl => 300);
Creates an A record. Returns a WWW::Hetzner::Cloud::RRSet object.
add_aaaa
my $record = $rrsets->add_aaaa('www', '2001:db8::1', ttl => 300);
Creates an AAAA record. Returns a WWW::Hetzner::Cloud::RRSet object.
add_cname
my $record = $rrsets->add_cname('blog', 'www.example.com.', ttl => 3600);
Creates a CNAME record. Target should end with a dot. Returns a WWW::Hetzner::Cloud::RRSet object.
add_mx
my $record = $rrsets->add_mx('@', 'mail.example.com.', 10, ttl => 3600);
Creates an MX record with priority. Returns a WWW::Hetzner::Cloud::RRSet object.
add_txt
my $record = $rrsets->add_txt('@', 'v=spf1 include:_spf.example.com ~all');
Creates a TXT record. Returns a WWW::Hetzner::Cloud::RRSet object.
SUPPORT
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/Getty/p5-www-hetzner
git clone https://github.com/Getty/p5-www-hetzner.git
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.