NAME

WWW::Hetzner::Cloud::PrimaryIP - Hetzner Cloud Primary IP object

VERSION

version 0.002

SYNOPSIS

my $pip = $cloud->primary_ips->get($id);

# Read attributes
print $pip->ip, "\n";
print $pip->type, "\n";  # ipv4 or ipv6

# Assign to server
$pip->assign($server_id, 'server');
$pip->unassign;

# Update
$pip->name('new-name');
$pip->auto_delete(1);
$pip->update;

# Delete
$pip->delete;

DESCRIPTION

This class represents a Hetzner Cloud primary IP. Objects are returned by WWW::Hetzner::Cloud::API::PrimaryIPs methods.

id

Primary IP ID (read-only).

name

Primary IP name (read-write).

ip

The IP address (read-only).

type

IP type: ipv4 or ipv6 (read-only).

assignee_id

Assigned resource ID, or undef if not assigned (read-only).

assignee_type

Type of assigned resource, e.g. "server" (read-only).

datacenter

Datacenter data hash (read-only).

dns_ptr

Arrayref of reverse DNS entries (read-only).

auto_delete

Whether to auto-delete when resource is deleted (read-write).

blocked

Whether the IP is blocked (read-only).

labels

Labels hash (read-write).

protection

Protection settings hash (read-only).

created

Creation timestamp (read-only).

is_assigned

Returns true if assigned to a resource.

datacenter_name

Returns datacenter name.

update

$pip->name('new-name');
$pip->auto_delete(1);
$pip->update;

Saves changes to name, auto_delete, and labels.

delete

$pip->delete;

Deletes the primary IP.

assign

$pip->assign($server_id);
$pip->assign($server_id, 'server');

Assign to a resource.

unassign

$pip->unassign;

Unassign from current resource.

change_dns_ptr

$pip->change_dns_ptr($pip->ip, 'server.example.com');

Change reverse DNS pointer.

refresh

$pip->refresh;

Reloads primary IP data from the API.

data

my $hashref = $pip->data;

Returns all primary IP 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.