1 API Clients
Virgil edited this page 2026-03-11 12:04:24 +00:00

API Clients

Module: forge.lthn.ai/core/go-infra

CloudNS Client

NewCloudNSClient(authID, password) creates a client for the CloudNS DNS API (api.cloudns.net).

DNS Record Operations

Method Description
ListZones(ctx) Returns all DNS zones
ListRecords(ctx, domain) Returns all records for a zone
CreateRecord(ctx, domain, host, type, value, ttl) Creates a record, returns ID
UpdateRecord(ctx, domain, id, host, type, value, ttl) Updates an existing record
DeleteRecord(ctx, domain, id) Deletes a record by ID
EnsureRecord(ctx, domain, host, type, value, ttl) Idempotent create-or-update, returns (changed bool, err)

ACME Helpers

  • SetACMEChallenge(ctx, domain, value) — Creates _acme-challenge TXT record (TTL 60s)
  • ClearACMEChallenge(ctx, domain) — Removes all _acme-challenge TXT records

Hetzner Cloud Client

NewHCloudClient(token) creates a client for the Hetzner Cloud API (api.hetzner.cloud/v1). Uses Bearer token auth.

Types

  • HCloudServer — ID, Name, Status, PublicNet (IPv4), PrivateNet, ServerType, Datacenter, Labels
  • HCloudLoadBalancer — ID, Name, PublicNet, Algorithm, Services, Targets, Location, Labels
  • HCloudLBCreateRequest — Creation parameters for load balancers

Hetzner Robot Client

NewHRobotClient(user, password) creates a client for dedicated server management (robot-ws.your-server.de). Uses Basic auth.

  • HRobotServer — ServerIP, ServerName, Product, Datacenter, Status, PaidUntil

Infrastructure Config

Load(path) reads infra.yaml. Discover(startDir) walks up directories looking for infra.yaml.

Helper: cfg.HostsByRole(role) filters hosts, cfg.AppServers() returns hosts with role "app".