1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

refactor: modernize floating_ip and primary_ip modules (#771)

##### SUMMARY

Use the latest best practices for modules, and prepare for the upcoming
changes.
This commit is contained in:
Jonas L. 2025-12-16 16:13:31 +01:00 committed by GitHub
parent 1c84cd30e8
commit b4616f3af8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 276 additions and 224 deletions

View file

@ -0,0 +1,19 @@
from __future__ import annotations
from ..module_utils.vendor.hcloud.floating_ips import (
BoundFloatingIP,
)
def prepare_result(o: BoundFloatingIP):
return {
"id": o.id,
"name": o.name,
"description": o.description,
"ip": o.ip,
"type": o.type,
"home_location": o.home_location.name,
"labels": o.labels,
"server": o.server.name if o.server is not None else None,
"delete_protection": o.protection["delete"],
}