NAME

WWW::Hetzner::Cloud::Volume - Hetzner Cloud Volume object

VERSION

version 0.002

SYNOPSIS

my $volume = $cloud->volumes->get($id);

# Read attributes
print $volume->id, "\n";
print $volume->name, "\n";
print $volume->size, " GB\n";
print $volume->linux_device, "\n";

# Attach to server
$volume->attach($server_id);
$volume->detach;

# Resize
$volume->resize(100);  # 100 GB

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

# Delete
$volume->delete;

DESCRIPTION

This class represents a Hetzner Cloud volume. Objects are returned by WWW::Hetzner::Cloud::API::Volumes methods.

id

Volume ID (read-only).

name

Volume name (read-write).

status

Volume status (read-only).

size

Volume size in GB (read-only).

server

Attached server ID, or undef if not attached (read-only).

created

Creation timestamp (read-only).

labels

Labels hash (read-write).

linux_device

Linux device path, e.g. "/dev/disk/by-id/scsi-0HC_Volume_123" (read-only).

format

Filesystem format, e.g. "ext4" (read-only).

protection

Protection settings hash (read-only).

location

Location name (convenience accessor).

is_attached

Returns true if volume is attached to a server.

update

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

Saves changes to name and labels.

delete

$volume->delete;

Deletes the volume.

attach

$volume->attach($server_id);
$volume->attach($server_id, automount => 1);

Attaches volume to a server. Options: automount => 1.

detach

$volume->detach;

Detaches volume from server.

resize

$volume->resize(100);  # 100 GB

Resizes volume to new size in GB. Can only increase size.

refresh

$volume->refresh;

Reloads volume data from the API.

data

my $hashref = $volume->data;

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