provisioning-catalog/providers/porkbun/provider.nu

57 lines
2.2 KiB
Text
Raw Normal View History

use ./nulib/porkbun/mod.nu *
export def get-provider-metadata []: nothing -> record {
{
name: "porkbun"
version: "1.0.0"
type: "registrar"
description: "Porkbun domain registrar — domain lifecycle and nameserver management via API v3"
capabilities: {
server_management: false
network_management: false
storage_management: false
load_balancer: false
firewall: false
floating_ip: false
dns_management: false
domain_registrar: true
}
api: {
type: "rest"
base_url: "https://porkbun.com/api/json/v3"
auth_method: "api_key_in_body"
documentation: "https://porkbun.com/api/json/v3/documentation"
version: "v3"
}
}
}
export def registrar_list_domains [filter: record]: nothing -> list<record> {
pk_list_domains $filter
}
export def registrar_domain_info [domain: string]: nothing -> record {
pk_domain_info $domain
}
export def registrar_get_nameservers [domain: string]: nothing -> list<string> {
pk_get_nameservers $domain
}
export def registrar_set_nameservers [domain: string, ns: list<string>]: nothing -> bool {
pk_set_nameservers $domain $ns
}
export def registrar_set_auto_renew [domain: string, enable: bool]: nothing -> bool {
pk_set_auto_renew $domain $enable
}
# Stub compute functions — Porkbun is registrar-only
export def query_servers [find?: string, cols?: string]: nothing -> list { [] }
export def server_info [server: string, check: bool, find?: string, cols?: string]: nothing -> record { {} }
export def server_exists [server: string, error_exit: bool]: nothing -> bool { false }
export def server_is_running [server: string, error_exit: bool]: nothing -> bool { false }
export def check_server_requirements [settings: record, server: record, check: bool]: nothing -> bool { false }
export def delete_server [settings: record, server: record, keep_storage: bool, error_exit: bool]: nothing -> bool { false }
export def get_ip [settings: record, server: string, ip_type: string, error_exit: bool]: nothing -> string { "" }