NAME
WWW::Hetzner::Cloud::API::SSHKeys - Hetzner Cloud SSH Keys API
VERSION
version 0.002
SYNOPSIS
use WWW::Hetzner::Cloud;
my $cloud = WWW::Hetzner::Cloud->new(token => $ENV{HETZNER_API_TOKEN});
# List all SSH keys
my $keys = $cloud->ssh_keys->list;
# Create a new key
my $key = $cloud->ssh_keys->create(
name => 'my-key',
public_key => 'ssh-ed25519 AAAA...',
);
# Key is a WWW::Hetzner::Cloud::SSHKey object
print $key->fingerprint, "\n";
# Update key
$key->name('renamed-key');
$key->update;
# Delete key
$key->delete;
DESCRIPTION
This module provides the API for managing Hetzner Cloud SSH keys. All methods return WWW::Hetzner::Cloud::SSHKey objects.
list
my $keys = $cloud->ssh_keys->list;
Returns an arrayref of WWW::Hetzner::Cloud::SSHKey objects.
get
my $key = $cloud->ssh_keys->get($id);
Returns a WWW::Hetzner::Cloud::SSHKey object.
get_by_name
my $key = $cloud->ssh_keys->get_by_name('my-key');
Returns a WWW::Hetzner::Cloud::SSHKey object. Returns undef if not found.
create
my $key = $cloud->ssh_keys->create(
name => 'my-key',
public_key => 'ssh-ed25519 AAAA...',
labels => { env => 'prod' }, # optional
);
Creates a new SSH key. Returns a WWW::Hetzner::Cloud::SSHKey object.
update
$cloud->ssh_keys->update($id, name => 'new-name');
Updates SSH key name or labels. Returns a WWW::Hetzner::Cloud::SSHKey object.
delete
$cloud->ssh_keys->delete($id);
Deletes an SSH key.
ensure
my $key = $cloud->ssh_keys->ensure('my-key', $public_key);
Ensures an SSH key exists with the given name and public key content. If a key with that name exists but has different content, it will be deleted and recreated. Returns a WWW::Hetzner::Cloud::SSHKey object.
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.