Documentation
¶
Overview ¶
Package regfishapi is a Go client for the regfish DNS & TLS API (v1).
The API is documented at https://regfish.de/docs; the machine readable contract can be fetched with Client.DownloadOpenAPISpec.
All API calls authenticate with an API key ("x-api-key" header) that is created in the regfish dash under Account > Security > API keys.
Index ¶
- Constants
- Variables
- func DeniedOperation(err error) (string, bool)
- func ErrorCode(err error) int
- func IsDomainGuardianBlocked(err error) bool
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsPermanent(err error) bool
- func IsPermissionDenied(err error) bool
- func IsRateLimited(err error) bool
- func IsUnauthorized(err error) bool
- func MissingPermission(err error) (string, bool)
- func StatusCode(err error) int
- type APIError
- type Authinfo
- type Client
- func (c *Client) AddRecord(ctx context.Context, record Record) (Record, error)
- func (c *Client) CancelCertificate(ctx context.Context, certificateID string, req *TLSCertificateCancelRequest) (TLSCertificate, error)
- func (c *Client) CancelDNSSECByDomain(ctx context.Context, domain string) (DNSSEC, error)
- func (c *Client) CancelIssuedCertificateOrder(ctx context.Context, certificateID string, ...) (TLSCertificate, error)
- func (c *Client) CheckPermissions(ctx context.Context, permissions ...string) (PermissionReport, error)
- func (c *Client) CompleteCertificate(ctx context.Context, certificateID, orgID string) (TLSCertificate, error)
- func (c *Client) CreateCertificate(ctx context.Context, req TLSCertificateRequest) (TLSCertificate, error)
- func (c *Client) CreateOrganization(ctx context.Context, req TLSOrganizationCreateRequest) (TLSOrganization, error)
- func (c *Client) CreateRecord(record Record) (Record, error)deprecated
- func (c *Client) DeleteRecord(rrid int) errordeprecated
- func (c *Client) DeleteRecordByRRID(ctx context.Context, rrid int) error
- func (c *Client) DownloadCertificate(ctx context.Context, certificateID, format string) (TLSCertificateDownload, error)
- func (c *Client) DownloadOpenAPISpec(ctx context.Context) ([]byte, error)
- func (c *Client) ExportDNSZoneBindByDomain(ctx context.Context, domain string) ([]byte, error)
- func (c *Client) GetCertificateByID(ctx context.Context, certificateID string) (TLSCertificate, error)
- func (c *Client) GetDNSSECByDomain(ctx context.Context, domain string) (DNSSEC, error)
- func (c *Client) GetDNSZoneByDomain(ctx context.Context, domain string) (ZoneDetail, error)
- func (c *Client) GetDomainByName(ctx context.Context, domain string) (DomainDetails, error)
- func (c *Client) GetHostingPackage(ctx context.Context, id string) (HostingPackage, error)
- func (c *Client) GetNameserversByDomain(ctx context.Context, domain string) (Nameservers, error)
- func (c *Client) GetOrganizationByID(ctx context.Context, organizationID string) (TLSOrganization, error)
- func (c *Client) GetRecord(rrid int) (Record, error)deprecated
- func (c *Client) GetRecordByRRID(ctx context.Context, rrid int) (Record, error)
- func (c *Client) GetRecordsByDomain(domain string) ([]Record, error)deprecated
- func (c *Client) GetTokenInfo(ctx context.Context) (TokenInfo, error)
- func (c *Client) ListCertificates(ctx context.Context) ([]TLSCertificate, error)
- func (c *Client) ListDNSSECJobsByDomain(ctx context.Context, domain string) ([]DNSSECJob, error)
- func (c *Client) ListDNSZones(ctx context.Context) ([]ZoneSummary, error)
- func (c *Client) ListDomains(ctx context.Context, opts *ListDomainsOptions) (DomainList, error)
- func (c *Client) ListHostingAliases(ctx context.Context, id string) ([]HostingAlias, error)
- func (c *Client) ListHostingDatabases(ctx context.Context, id string) ([]HostingDatabase, error)
- func (c *Client) ListHostingPackages(ctx context.Context) ([]HostingPackage, error)
- func (c *Client) ListOrganizations(ctx context.Context) ([]TLSOrganization, error)
- func (c *Client) ListRecordsByDomain(ctx context.Context, domain string) ([]Record, error)
- func (c *Client) ListTLSProducts(ctx context.Context) ([]TLSProduct, error)
- func (c *Client) PatchOrganizationByID(ctx context.Context, organizationID string, req TLSOrganizationPatchRequest) (TLSOrganization, error)
- func (c *Client) PatchRecord(ctx context.Context, record Record) (Record, error)
- func (c *Client) PatchRecordByRRID(ctx context.Context, rrid int, record Record) (Record, error)
- func (c *Client) PutDNSSECByDomain(ctx context.Context, domain string, req DNSSECRequest) (DNSSEC, error)
- func (c *Client) PutNameserversByDomain(ctx context.Context, domain string, vanitySetID *int) (Nameservers, error)
- func (c *Client) ReissueCertificate(ctx context.Context, certificateID string, req TLSCertificateReissueRequest) (TLSCertificate, error)
- func (c *Client) Request(method, endpoint string, body interface{}, headers map[string]string) ([]byte, error)deprecated
- func (c *Client) RequestAuthinfoByDomain(ctx context.Context, domain string) (Authinfo, error)
- func (c *Client) RequestContext(ctx context.Context, method, endpoint string, body interface{}, ...) ([]byte, error)
- func (c *Client) RevokeCertificate(ctx context.Context, certificateID string, req *TLSCertificateRevokeRequest) (TLSCertificate, error)
- func (c *Client) UpdateRecord(record Record) (Record, error)deprecated
- func (c *Client) UpdateRecordById(rrid int, record Record) (Record, error)deprecated
- func (c *Client) VerifyDNSSECByDomain(ctx context.Context, domain string) (DNSSEC, error)
- type DNSSEC
- type DNSSECCapabilities
- type DNSSECJob
- type DNSSECRecord
- type DNSSECRequest
- type Decision
- type Denial
- type Domain
- type DomainDetails
- type DomainList
- type HostingAlias
- type HostingBackup
- type HostingDatabase
- type HostingPackage
- type KeyKind
- type ListDomainsOptions
- type Nameservers
- type Option
- type PermissionReport
- type Record
- type TLSCertificate
- type TLSCertificateCancelRequest
- type TLSCertificateDownload
- type TLSCertificateOrderCancelRequest
- type TLSCertificateOrganization
- type TLSCertificateReissueRequest
- type TLSCertificateRequest
- type TLSCertificateRevokeRequest
- type TLSOrganization
- type TLSOrganizationCreateRequest
- type TLSOrganizationPatchRequest
- type TLSProduct
- type TLSProductPrice
- type TLSProductSpecs
- type TLSReissue
- type TLSValidation
- type TLSValidationDNSRecord
- type TokenInfo
- func (t TokenInfo) CheckPermissions(permissions ...string) PermissionReport
- func (t TokenInfo) HasPermission(permission string) bool
- func (t TokenInfo) IsLegacy() bool
- func (t TokenInfo) IsScopeLimited() bool
- func (t TokenInfo) Kind() KeyKind
- func (t TokenInfo) Permits(permission string) Decision
- func (t TokenInfo) ScopeName() string
- type VanitySet
- type ZoneCounts
- type ZoneDelegationNameserver
- type ZoneDetail
- type ZoneRecord
- type ZoneSOA
- type ZoneSummary
Constants ¶
const ( CodeSuccess = 0 CodeFailed = 1 // Domains CodeDomainNotFound = 18001 CodeDomainGuardBlocked = 18002 CodeNameserverChangeNotAllowed = 18003 CodeNameserverRateLimited = 18004 CodeVanitySetNotFound = 18006 CodeAuthinfoRateLimited = 18007 // Hosting CodeHostingPackageNotFound = 19001 // Zones CodeZoneNotFound = 13001 // Schema CodeSchemaValidationFailed = 14001 // Resource records CodeResourceRecordNotFound = 15001 CodeResourceRecordOutsideOfZone = 15002 CodeResourceRecordAlreadyExists = 15003 CodeResourceRecordNotAllowed = 15004 // DNSSEC CodeDNSSECDomainNotFound = 17001 CodeDNSSECUnsupported = 17002 CodeDNSSECInvalidMode = 17003 CodeDNSSECInvalidRecordSet = 17004 CodeDNSSECJobPending = 17005 CodeDNSSECRegistryError = 17006 CodeDNSSECVerificationFailed = 17007 CodeDNSSECForbiddenForState = 17008 // TLS CodeTLSCertificateNotFound = 16001 CodeTLSCertificateInvalidState = 16002 CodeTLSCertificateProviderError = 16003 CodeTLSCertificateUnknownProduct = 16004 CodeTLSCertificateInvalidCSR = 16005 CodeTLSCertificateDownloadNotReady = 16006 CodeTLSOrganizationNotFound = 16007 )
regfish API error codes, mirroring server/api/errors.ts.
const ( // DNSSECModeNone leaves no registry DNSSEC active. DNSSECModeNone = "none" // DNSSECModeRegfish lets regfish sign the zone and manage the registry // trust anchors. Only valid while the domain uses regfish nameservers. DNSSECModeRegfish = "regfish" // DNSSECModeExternal expects the caller to supply the DNSSEC records of // external authoritative nameservers. DNSSECModeExternal = "external" )
DNSSEC operating modes.
const ( DNSSECStateEnabled = "enabled" DNSSECStateDisabled = "disabled" )
Desired DNSSEC states accepted by PutDNSSECByDomain.
const ( DNSSECStatePendingEnable = "pending_enable" DNSSECStatePendingDisable = "pending_disable" DNSSECStateError = "error" DNSSECStateDrift = "drift" DNSSECStateUnknown = "unknown" )
Fine-grained registry DNSSEC states reported in DNSSEC.DesiredState and DNSSEC.LiveState.
const ( DNSSECDisplayActive = "active" DNSSECDisplayPending = "pending" DNSSECDisplayInactive = "inactive" )
High-level DNSSEC states reported in DNSSEC.DNSSECState.
const ( DNSSECRecordKindDS = "ds" DNSSECRecordKindDNSKEY = "dnskey" )
DNSSEC record kinds.
const ( NameserverModeStandard = "standard" NameserverModeVanity = "vanity" NameserverModeExternal = "external" )
Nameserver delegation modes returned by GetNameserversByDomain.
const ( DomainSortByDomain = "domain" DomainSortByExpiresAt = "expires_at" DomainSortByCancelled = "cancelled" DomainSortByPrimaryNameserver = "primary_nameserver" DomainSortByDNSSECState = "dnssec_state" DomainSortByOwner = "owner" DomainSortByRegisteredAt = "registered_at" )
Sort keys accepted by ListDomainsOptions.SortBy.
const ( DomainFilterCancelled = "cancelled" DomainFilterDNSSECInactive = "dnssec-inactive" )
Filters accepted by ListDomainsOptions.Filters.
const ( SortAsc = "asc" SortDesc = "desc" )
Sort directions.
const ( PermissionDomainRead = "domain:read" PermissionDomainWrite = "domain:write" PermissionDNSRead = "dns:read" PermissionDNSWrite = "dns:write" PermissionTLSRead = "tls:read" PermissionTLSWrite = "tls:write" PermissionHostingRead = "hosting:read" )
API permissions that at least one v1 operation requires. A key created before RBAC (TokenInfo.Permissions == nil) holds all of them.
The RBAC vocabulary is larger than this — it also covers email, WordPress, SEO, hosting writes and the account/billing/team/security surfaces — but no operation in this API needs any of those, so they are deliberately not exported: asking for one in Client.CheckPermissions would fail a deployment over a permission that could never have caused a denial here.
const ( RecordTypeA = "A" RecordTypeAAAA = "AAAA" RecordTypeCNAME = "CNAME" RecordTypeCAA = "CAA" RecordTypeALIAS = "ALIAS" RecordTypeTXT = "TXT" RecordTypeMX = "MX" RecordTypeSRV = "SRV" RecordTypeTLSA = "TLSA" )
Record type constants accepted by the API.
const ( TLSProductRapidSSL = "RapidSSL" TLSProductRapidSSLWildcard = "RapidSSLWildcard" TLSProductQuickSSLPremium = "QuickSSLPremium" TLSProductSSL123 = "SSL123" TLSProductTrueBusinessID = "TrueBusinessID" TLSProductSecureSite = "SecureSite" TLSProductSSLWebServer = "SSLWebServer" )
TLS certificate product SKUs.
const ( DCVMethodDNSCNAMEToken = "dns-cname-token" DCVMethodEmail = "email" )
Domain control validation methods.
const ( TLSStatusPending = "pending" TLSStatusIssued = "issued" TLSStatusPendingCancellation = "pending_cancellation" TLSStatusPendingRevocation = "pending_revocation" TLSStatusPendingOrderRevocation = "pending_order_revocation" TLSStatusCancelled = "cancelled" TLSStatusOrderCancelled = "order_cancelled" TLSStatusRevoked = "revoked" TLSStatusOrderRevoked = "order_revoked" TLSStatusRejected = "rejected" TLSStatusExpired = "expired" TLSStatusUnknown = "unknown" )
TLS certificate lifecycle states.
const ( RevocationReasonUnspecified = "unspecified" RevocationReasonKeyCompromise = "keyCompromise" RevocationReasonAffiliationChanged = "affiliationChanged" RevocationReasonSuperseded = "superseded" RevocationReasonCessationOfOperation = "cessationOfOperation" )
Revocation reasons forwarded to the CA.
const ( TLSDownloadFormatPEM = "pem" TLSDownloadFormatZIP = "zip" )
Certificate download formats.
const ( TLSOrganizationStatusReady = "ready" TLSOrganizationStatusIncomplete = "incomplete" )
TLS organization readiness.
const ( // TLSOrgEditModeCreateReplacement creates a replacement organization when // validation-relevant fields change. TLSOrgEditModeCreateReplacement = "create_replacement" // TLSOrgEditModeUpdateProvider updates the existing provider record. TLSOrgEditModeUpdateProvider = "update_provider" )
Edit modes for TLSOrganizationPatchRequest.
const DefaultBaseURL = "https://api.regfish.de"
DefaultBaseURL is the API endpoint used when no other base URL is configured. https://api.regfish.com serves the same API and is the endpoint listed in the OpenAPI specification; either can be selected with WithBaseURL.
const DefaultUserAgent = "regfish-dnsapi-go"
DefaultUserAgent identifies this client to the API.
const ScopeACMEDNSChallenge = "acme-dns-challenge"
ScopeACMEDNSChallenge is the Scope of the platform credential regfish issues for ACME DNS-01 challenges. The API restricts such a key to adding, patching and deleting _acme-challenge TXT records and to GetTokenInfo, whatever permissions it carries.
Variables ¶
var ( // ErrTokenInfoIncomplete means the payload omitted the permissions member, // which cannot be told apart from an explicit null and would read as a // legacy key with full access. ErrTokenInfoIncomplete = errors.New("regfish: token info omitted the permissions field") // ErrTokenInfoMalformed means the payload was empty or not valid token // metadata. ErrTokenInfoMalformed = errors.New("regfish: malformed token info") )
Errors ParseTokenInfo — and therefore GetTokenInfo — can return for a payload it will not interpret. Match them with errors.Is rather than on the message text.
Functions ¶
func DeniedOperation ¶ added in v0.2.0
DeniedOperation returns the operationId the API named when it refused a scope-bound credential or an operation it has no permission mapping for, and reports whether the denial named one.
func ErrorCode ¶ added in v0.2.0
ErrorCode returns the regfish error code of err, or 0 if err is not an *APIError.
func IsDomainGuardianBlocked ¶ added in v0.2.0
IsDomainGuardianBlocked reports whether the Domain-Guardian blocked the change. The block is permanent until a human confirms the change in the regfish dash or exempts this API key on the domain's protection page.
The API reports it in two incompatible shapes: HTTP 403 with CodeDomainGuardBlocked on the domain endpoints, but HTTP 500 with CodeFailed on the DNS record endpoints, where status and code alone cannot tell it from a genuine server fault. Callers that retry on 5xx must check this first, or they will retry a decision that can never succeed.
One case is beyond reach: the guardian block on PUT /dns/{domain}/dnssec is also served as HTTP 500, but 500 is not among that operation's documented responses, so the API's own response validator discards the body and sends a generic server error instead. Nothing in the response survives to identify it, here or in any other client. Both this and the ACME quota gap are server-side defects (see docs/API-REVIEW-2026-08-01.md, finding H4) rather than limits of this classification.
func IsForbidden ¶ added in v0.2.0
IsForbidden reports whether err is an *APIError with HTTP status 403.
It is a transport-level predicate. Prefer IsPermissionDenied, which is true for the authorization denials specifically, and IsDomainGuardianBlocked, which also catches the guardian block the API serves as HTTP 500.
func IsNotFound ¶ added in v0.2.0
IsNotFound reports whether err is an *APIError with HTTP status 404.
The API renders a reference to another customer's domain, record or zone as not-found rather than forbidden, deliberately, so that it cannot be used to probe for the existence of other tenants' objects. A 404 therefore means "not found, or not reachable with this key" — never assert from it that the object does not exist.
func IsPermanent ¶ added in v0.2.0
IsPermanent reports whether err is a denial that no retry can clear — authentication, permission, scope, an unmapped operation or a Domain-Guardian block. A quota denial is not permanent: it clears when the window or the calendar day rolls over.
IsPermanent is one-directional. False means "not known to be permanent", not "safe to retry": several policy refusals the library deliberately does not classify are permanent too, notably the plan and chargeable-TLD gates that share HTTP 409 and CodeNameserverChangeNotAllowed with a transient transfer-in-progress. Cap your retries either way.
func IsPermissionDenied ¶ added in v0.2.0
IsPermissionDenied reports whether the API refused err because of what this credential is allowed to do: a missing permission, a scope-bound credential, or an operation the server has not mapped.
It is false for a Domain-Guardian block, which has a different remedy — see IsDomainGuardianBlocked — and false for HTTP 401, which means the key was not accepted at all. Use DenialOf when the three sub-cases need different handling.
func IsRateLimited ¶ added in v0.2.0
IsRateLimited reports whether err is an *APIError with HTTP status 429.
The API sends no Retry-After header. The nameserver and auth-code budgets reset on the UTC calendar day, the ACME limiter over a 60 second window; the Code field tells them apart.
func IsUnauthorized ¶ added in v0.2.0
IsUnauthorized reports whether err is an *APIError with HTTP status 401. The API answers 401 for an absent, malformed, unknown or deactivated key alike, and does not distinguish the four.
func MissingPermission ¶ added in v0.2.0
MissingPermission returns the permission the API named when it denied the request, e.g. "dns:write", and reports whether the denial named one at all.
Only the missing-permission denial carries a permission; scope and unmapped-operation denials name an operation instead — see DeniedOperation.
The value comes from the response, so it is always current: the library keeps no local operation-to-permission table.
func StatusCode ¶ added in v0.2.0
StatusCode returns the HTTP status code of err, or 0 if err is not an *APIError.
Types ¶
type APIError ¶ added in v0.2.0
type APIError struct {
// StatusCode is the HTTP status code of the response.
StatusCode int
// Code is the regfish error code (see the Code* constants). It is 0 when
// the response carried no code.
Code int
// Message is the human readable "message" field, if any.
Message string
// Detail is the human readable "error" field, if any.
Detail string
// Body is the raw response body, useful when the error was not a JSON
// envelope (e.g. a proxy error page).
Body []byte
}
APIError is returned for every request the API did not answer successfully. It carries the transport status code as well as the "code", "error" and "message" fields of the API's error envelope, so callers can distinguish e.g. a duplicate record from a zone constraint violation.
func (*APIError) Reason ¶ added in v0.2.0
Reason returns the API's human readable explanation, without the status and code prefix that Error adds.
The API puts the text in "message" on some endpoints and in "error" on others — the same Domain-Guardian block uses "message" on the domain endpoints and "error" on the record and DNSSEC endpoints — so Reason reads both.
When both are set, "error" comes first: the one response that populates both carries the diagnosis there and a follow-up instruction in "message" ("Invalid JSON payload received." + "Please check your request and try again."), so the other order reads as though the instruction caused the error.
type Authinfo ¶ added in v0.2.0
Authinfo is a transfer authorization code generated at the registry.
type Client ¶
type Client struct {
BaseURL string
APIKey string
Client *http.Client
// contains filtered or unexported fields
}
Client struct holds the API client configuration including the base URL and the API key for authentication.
func (*Client) AddRecord ¶ added in v0.2.0
AddRecord creates a new DNS record. The zone is detected automatically from the record's Name, which must be fully qualified for this endpoint.
With an ordinary customer key, re-creating an existing record fails with CodeResourceRecordAlreadyExists. With a capability-scoped ACME credential the same call is idempotent: an identical _acme-challenge TXT record that is already present is returned as a success, with its existing ID.
That difference is the only recovery path an ACME integration has. Such a credential may not call any read operation, so a solver that loses the rrid of a challenge record — a process restart between publish and cleanup — cannot look it up. Re-posting the identical name and value returns the record with its ID so it can then be deleted.
func (*Client) CancelCertificate ¶ added in v0.2.0
func (c *Client) CancelCertificate(ctx context.Context, certificateID string, req *TLSCertificateCancelRequest) (TLSCertificate, error)
CancelCertificate cancels a pending TLS certificate order. Use CancelIssuedCertificateOrder when an already issued order should be revoked in full. req may be nil.
func (*Client) CancelDNSSECByDomain ¶ added in v0.2.0
CancelDNSSECByDomain cancels a pending DNSSEC activation or — for regfish-managed nameservers — a pending deactivation. The API answers 409 when no cancellable transition exists.
func (*Client) CancelIssuedCertificateOrder ¶ added in v0.2.0
func (c *Client) CancelIssuedCertificateOrder(ctx context.Context, certificateID string, req *TLSCertificateOrderCancelRequest) (TLSCertificate, error)
CancelIssuedCertificateOrder cancels a not-yet-issued order, or revokes the complete issued order within the first 7 days after ordering. A full revocation invalidates all certificate versions of that order and prevents further reissues. req may be nil.
func (*Client) CheckPermissions ¶ added in v0.2.0
func (c *Client) CheckPermissions(ctx context.Context, permissions ...string) (PermissionReport, error)
CheckPermissions reports how the API key in use relates to the permissions this program needs. It performs exactly one request (GET /meta/token, the one endpoint every valid key may call) and never blocks, alters or pre-empts any other call.
Call it once at startup and log or act on the report, so a misconfigured key fails the deployment instead of the first write hours later:
r, err := client.CheckPermissions(ctx, regfishapi.PermissionDNSWrite)
if err != nil {
log.Fatal(err)
}
if !r.Satisfied() {
log.Fatal(r)
}
Gate on Satisfied rather than on len(Missing): a capability-scoped credential has no missing permissions and still cannot do the work, so a Missing-only check would wave it through.
The report only reflects the key's permissions and scope. It cannot see Domain-Guardian rules, domain ownership, plan entitlements or daily quotas, so a satisfied report is not a promise that a later call will succeed.
On error the returned report has Kind KeyKindUnknown.
func (*Client) CompleteCertificate ¶ added in v0.2.0
func (c *Client) CompleteCertificate(ctx context.Context, certificateID, orgID string) (TLSCertificate, error)
CompleteCertificate completes an action-required order by binding it to an existing usable organization and submitting it to the provider.
func (*Client) CreateCertificate ¶ added in v0.2.0
func (c *Client) CreateCertificate(ctx context.Context, req TLSCertificateRequest) (TLSCertificate, error)
CreateCertificate creates a new TLS certificate order or renews an existing certificate.
OV and EV style products can answer with ActionRequired set, in which case the order has to be completed with CompleteCertificate.
func (*Client) CreateOrganization ¶ added in v0.2.0
func (c *Client) CreateOrganization(ctx context.Context, req TLSOrganizationCreateRequest) (TLSOrganization, error)
CreateOrganization creates a TLS organization including the local contact record used for OV and EV ordering.
func (*Client) CreateRecord
deprecated
func (*Client) DeleteRecord
deprecated
func (*Client) DeleteRecordByRRID ¶ added in v0.2.0
DeleteRecordByRRID deletes the DNS record with the given RRID.
func (*Client) DownloadCertificate ¶ added in v0.2.0
func (c *Client) DownloadCertificate(ctx context.Context, certificateID, format string) (TLSCertificateDownload, error)
DownloadCertificate downloads an issued certificate. format is TLSDownloadFormatPEM or TLSDownloadFormatZIP.
func (*Client) DownloadOpenAPISpec ¶ added in v0.2.0
DownloadOpenAPISpec downloads the current OpenAPI specification as YAML.
func (*Client) ExportDNSZoneBindByDomain ¶ added in v0.2.0
ExportDNSZoneBindByDomain exports the zone as a BIND-compatible zone file. Non-standard ALIAS records are included as comments and, where possible, as resolved A records.
func (*Client) GetCertificateByID ¶ added in v0.2.0
func (c *Client) GetCertificateByID(ctx context.Context, certificateID string) (TLSCertificate, error)
GetCertificateByID retrieves a single TLS certificate.
func (*Client) GetDNSSECByDomain ¶ added in v0.2.0
GetDNSSECByDomain retrieves the DNSSEC configuration and status of a domain.
func (*Client) GetDNSZoneByDomain ¶ added in v0.2.0
GetDNSZoneByDomain retrieves the complete DNS zone of a domain, including all records and NS entries.
func (*Client) GetDomainByName ¶ added in v0.2.0
GetDomainByName retrieves the details of a single registered domain.
func (*Client) GetHostingPackage ¶ added in v0.2.0
GetHostingPackage retrieves a single web hosting package.
func (*Client) GetNameserversByDomain ¶ added in v0.2.0
GetNameserversByDomain returns the current delegation of the domain together with the vanity nameserver sets available on the account.
func (*Client) GetOrganizationByID ¶ added in v0.2.0
func (c *Client) GetOrganizationByID(ctx context.Context, organizationID string) (TLSOrganization, error)
GetOrganizationByID retrieves a single TLS organization.
func (*Client) GetRecordByRRID ¶ added in v0.2.0
GetRecordByRRID retrieves details about a specific DNS record by RRID.
func (*Client) GetRecordsByDomain
deprecated
func (*Client) GetTokenInfo ¶ added in v0.2.0
GetTokenInfo returns metadata about the API key in use: its public key id, the granted permissions, the capability scope and the customer it is scoped to.
Every valid key may call this, including capability-scoped ones, so it is a safe startup probe. It returns an error if the response omits the permission list entirely, because an absent list cannot be told apart from an explicit null — which would silently read as a legacy key with full access.
func (*Client) ListCertificates ¶ added in v0.2.0
func (c *Client) ListCertificates(ctx context.Context) ([]TLSCertificate, error)
ListCertificates lists the TLS certificates of the account.
func (*Client) ListDNSSECJobsByDomain ¶ added in v0.2.0
ListDNSSECJobsByDomain retrieves the recent registry DNSSEC jobs of a domain.
func (*Client) ListDNSZones ¶ added in v0.2.0
func (c *Client) ListDNSZones(ctx context.Context) ([]ZoneSummary, error)
ListDNSZones lists the DNS zones of the account with SOA data, delegated nameservers, DNSSEC status and record counts.
func (*Client) ListDomains ¶ added in v0.2.0
func (c *Client) ListDomains(ctx context.Context, opts *ListDomainsOptions) (DomainList, error)
ListDomains lists the customer's registered domains. opts may be nil.
func (*Client) ListHostingAliases ¶ added in v0.2.0
ListHostingAliases lists the domain aliases of a hosting package.
func (*Client) ListHostingDatabases ¶ added in v0.2.0
ListHostingDatabases lists the databases of a hosting package.
func (*Client) ListHostingPackages ¶ added in v0.2.0
func (c *Client) ListHostingPackages(ctx context.Context) ([]HostingPackage, error)
ListHostingPackages lists the customer's web hosting packages.
func (*Client) ListOrganizations ¶ added in v0.2.0
func (c *Client) ListOrganizations(ctx context.Context) ([]TLSOrganization, error)
ListOrganizations lists the TLS organizations usable for OV and EV orders.
func (*Client) ListRecordsByDomain ¶ added in v0.2.0
ListRecordsByDomain retrieves all DNS records stored in the zone of the given domain. NS records are not part of the result; use GetDNSZoneByDomain for a view that includes the zone's delegation.
func (*Client) ListTLSProducts ¶ added in v0.2.0
func (c *Client) ListTLSProducts(ctx context.Context) ([]TLSProduct, error)
ListTLSProducts lists the available certificate products together with the current account pricing.
func (*Client) PatchOrganizationByID ¶ added in v0.2.0
func (c *Client) PatchOrganizationByID(ctx context.Context, organizationID string, req TLSOrganizationPatchRequest) (TLSOrganization, error)
PatchOrganizationByID updates a TLS organization. Depending on EditMode and the changed fields the API may create a replacement organization with a new id instead of updating in place.
func (*Client) PatchRecord ¶ added in v0.2.0
PatchRecord updates a DNS record identified by its name and type — and, for every type except A and AAAA, its current data. Use PatchRecordByRRID to change a record's name or type, or when several records share the same name/type combination: this endpoint requires a unique match.
func (*Client) PatchRecordByRRID ¶ added in v0.2.0
PatchRecordByRRID updates the DNS record with the given RRID. Unlike PatchRecord this can also change the record's name and type.
func (*Client) PutDNSSECByDomain ¶ added in v0.2.0
func (c *Client) PutDNSSECByDomain(ctx context.Context, domain string, req DNSSECRequest) (DNSSEC, error)
PutDNSSECByDomain enables, disables or updates registry DNSSEC for a domain.
The response may already be final, or it may carry a PendingJob while the registry or the DNS delegation is still converging.
func (*Client) PutNameserversByDomain ¶ added in v0.2.0
func (c *Client) PutNameserversByDomain(ctx context.Context, domain string, vanitySetID *int) (Nameservers, error)
PutNameserversByDomain delegates the domain to one of the account's vanity nameserver sets, or — with a nil vanitySetID — back to the regfish standard nameservers. Free-form nameservers are not supported by this endpoint; external delegations are managed in the regfish dash.
The change is subject to the Domain-Guardian, the domain's status and a daily per-domain change limit, which surface as 403, 409 and 429.
func (*Client) ReissueCertificate ¶ added in v0.2.0
func (c *Client) ReissueCertificate(ctx context.Context, certificateID string, req TLSCertificateReissueRequest) (TLSCertificate, error)
ReissueCertificate reissues an already issued or certificate-revoked certificate with a new CSR, keeping the same order.
func (*Client) RequestAuthinfoByDomain ¶ added in v0.2.0
RequestAuthinfoByDomain generates the domain's transfer authorization code at the registry.
The code enables an outbound transfer — request it only on the domain owner's explicit demand. Requests are guarded by the Domain-Guardian and limited to 3 per domain and 10 per account per day; every issued code is recorded in the domain guard log.
func (*Client) RequestContext ¶ added in v0.2.0
func (c *Client) RequestContext(ctx context.Context, method, endpoint string, body interface{}, headers map[string]string) ([]byte, error)
RequestContext performs a raw request against the API and returns the response body. Non-2xx responses are returned as *APIError.
func (*Client) RevokeCertificate ¶ added in v0.2.0
func (c *Client) RevokeCertificate(ctx context.Context, certificateID string, req *TLSCertificateRevokeRequest) (TLSCertificate, error)
RevokeCertificate revokes only the currently selected certificate while keeping the order available for a later reissue. req may be nil.
func (*Client) UpdateRecord
deprecated
func (*Client) VerifyDNSSECByDomain ¶ added in v0.2.0
VerifyDNSSECByDomain refreshes the registry DNSSEC state and checks whether the delegation is visible. A successful response can still report "pending" when the target state has not propagated completely yet.
type DNSSEC ¶ added in v0.2.0
type DNSSEC struct {
Configured bool `json:"configured"`
// DNSSECState is the high-level status: "active", "pending" or "inactive".
DNSSECState string `json:"dnssec_state"`
// Mode is one of the DNSSECMode* constants.
Mode string `json:"mode"`
// DesiredState is the target registry state.
DesiredState string `json:"desired_state"`
// LiveState is the last state observed from the registry and delegation
// checks.
LiveState string `json:"live_state"`
Capabilities DNSSECCapabilities `json:"capabilities"`
DesiredRecords []DNSSECRecord `json:"desired_records"`
LiveRecords []DNSSECRecord `json:"live_records"`
LastErrorCode *string `json:"last_error_code"`
LastError *string `json:"last_error"`
LastRegistryName *string `json:"last_registry_name"`
LastRegistryRef *string `json:"last_registry_reference"`
LastRegistryStatus *string `json:"last_registry_status"`
LastVerifiedAt *int64 `json:"last_verified_at"`
LastAppliedAt *int64 `json:"last_applied_at"`
PendingJob *DNSSECJob `json:"pending_job"`
UsingRegfishNS bool `json:"using_regfish_nameservers"`
LegacyMode bool `json:"legacy_mode"`
ZoneSigned bool `json:"zone_signed"`
ZonePendingDisable bool `json:"zone_pending_disable"`
ZonePropagatedAt *int64 `json:"zone_propagated_at"`
Jobs []DNSSECJob `json:"jobs,omitempty"`
}
DNSSEC is the DNSSEC configuration and status of a domain.
DNSSEC changes can be asynchronous, so DesiredState and LiveState may differ temporarily; PendingJob is set while a transition is still in progress.
type DNSSECCapabilities ¶ added in v0.2.0
type DNSSECCapabilities struct {
Supported bool `json:"supported"`
Provider string `json:"provider"`
ModeRegfishAvailable bool `json:"mode_regfish_available"`
ModeExternalAvailable bool `json:"mode_external_available"`
AcceptedRecordKinds []string `json:"accepted_record_kinds"`
MinRecords int `json:"min_records"`
MaxRecords *int `json:"max_records"`
AcceptedAlgorithms []int `json:"accepted_algorithms"`
}
DNSSECCapabilities reports what the registry of a domain supports.
type DNSSECJob ¶ added in v0.2.0
type DNSSECJob struct {
ID int `json:"id"`
Action string `json:"action"`
Mode string `json:"mode"`
// Status is one of PENDING, RUNNING, WAITING, OK, ERROR or CANCELLED.
Status string `json:"status"`
Source string `json:"source"`
RegistryName *string `json:"registry_name"`
RegistryReference *string `json:"registry_reference"`
ErrorCode *string `json:"error_code"`
ErrorText *string `json:"error_text"`
TSCreated int64 `json:"ts_created"`
TSUpdated int64 `json:"ts_updated"`
TSStarted *int64 `json:"ts_started"`
TSFinished *int64 `json:"ts_finished"`
}
DNSSECJob is a registry DNSSEC transition job.
type DNSSECRecord ¶ added in v0.2.0
type DNSSECRecord struct {
// Kind is DNSSECRecordKindDS or DNSSECRecordKindDNSKEY.
Kind string `json:"kind"`
KeyTag *int `json:"key_tag,omitempty"`
Flags *int `json:"flags,omitempty"`
Protocol *int `json:"protocol,omitempty"`
Algorithm int `json:"algorithm"`
DigestType *int `json:"digest_type,omitempty"`
Digest string `json:"digest,omitempty"`
PublicKey string `json:"public_key,omitempty"`
Comment string `json:"comment,omitempty"`
}
DNSSECRecord is a DS or DNSKEY record used as a registry trust anchor.
type DNSSECRequest ¶ added in v0.2.0
type DNSSECRequest struct {
// Mode is one of the DNSSECMode* constants.
Mode string `json:"mode"`
// State is DNSSECStateEnabled or DNSSECStateDisabled. Use
// DNSSECModeNone together with DNSSECStateDisabled to switch registry
// DNSSEC off.
State string `json:"state"`
// VerifyAfterApply makes the API refresh the registry state and check the
// DNS delegation right after the update. Defaults to true when nil.
VerifyAfterApply *bool `json:"verify_after_apply,omitempty"`
// Records is required for Mode DNSSECModeExternal with State
// DNSSECStateEnabled and ignored otherwise.
Records []DNSSECRecord `json:"records,omitempty"`
}
DNSSECRequest is the payload of PutDNSSECByDomain.
type Decision ¶ added in v0.2.0
type Decision int
Decision is the library's advisory expectation about a permission. It is never authoritative: the API decides, and it can refuse for reasons no key metadata reveals (Domain-Guardian, ownership, plan entitlements, quotas).
const ( // DecisionUnknown means the library cannot say. It is returned for // capability-scoped credentials, whose permission list does not describe // what they may do, and for a TokenInfo that was never populated. DecisionUnknown Decision = iota // DecisionAllowed means the key holds the permission, or is a legacy key // with full access. DecisionAllowed // DecisionDenied means the key has a permission list that does not contain // this permission. DecisionDenied )
type Denial ¶ added in v0.2.0
type Denial int
Denial classifies why the API refused a request.
The classification is derived from the response, never from a local copy of the server's permission model: the pair (HTTP status, presence and value of the "code" member) does the work, and message text only refines an already established denial. An unrecognised message therefore degrades to the coarser value, never to DenialNone.
const ( // DenialNone means err is not a recognised authorization failure. It is // also returned for errors that are not *APIError and for denial shapes // this version does not know about — never read it as "the request was // permitted". DenialNone Denial = iota // DenialUnauthenticated is HTTP 401: the key was absent, malformed, // unknown or deactivated. The API does not distinguish these four. DenialUnauthenticated // DenialPermission means the key does not hold the permission the // operation requires. MissingPermission names it when the API did. DenialPermission // DenialScope means a scope-bound platform credential (see // ScopeACMEDNSChallenge) may not call this operation at all. Granting the // key more permissions does not help; a different key does. DenialScope // DenialUnmappedOperation means the server has no permission mapping for // the operation and denied it fail-closed. This is a server-side gap, not // an under-scoped key: no grant lifts it, and it affects every scoped key // at once. Worth reporting to regfish. DenialUnmappedOperation // DenialGuardian means the Domain-Guardian blocked the change. It is // permanent until a human confirms the change in the regfish dash or // exempts this API key there. DenialGuardian // DenialQuota means a rate limit or daily budget was exhausted. The API // sends no Retry-After header, and the budgets reset on the UTC calendar // day. // // Only the nameserver-change and auth-code budgets reach a client this way. // The ACME limiter also answers 429, but 429 is not among the documented // responses of the record endpoints, so the API's response validator // replaces it with a generic server error before it leaves the building — // see the note on IsDomainGuardianBlocked. DenialQuota )
type Domain ¶ added in v0.2.0
type Domain struct {
Domain string `json:"domain"`
SLD string `json:"sld"`
TLD string `json:"tld"`
Favorite bool `json:"favorite"`
OwnerContactID *int `json:"owner_contact_id"`
Owner string `json:"owner"`
PrimaryNameserver string `json:"primary_nameserver"`
// DNSSECState is the high-level status: "active", "pending" or "inactive".
DNSSECState string `json:"dnssec_state"`
AutoRenew bool `json:"auto_renew"`
Cancelled bool `json:"cancelled"`
RegisteredAt *int64 `json:"registered_at"`
ExpiresAt *int64 `json:"expires_at"`
}
Domain describes a registered domain in the customer's portfolio.
type DomainDetails ¶ added in v0.2.0
type DomainDetails struct {
Domain
// Nameservers holds the currently delegated nameservers, without a
// trailing dot.
Nameservers []string `json:"nameservers"`
}
DomainDetails adds the current delegation to a Domain.
type DomainList ¶ added in v0.2.0
type DomainList struct {
Domains []Domain `json:"domains"`
TotalItems int `json:"total_items"`
TotalPages int `json:"total_pages"`
Page int `json:"page"`
PageSize int `json:"page_size"`
Search string `json:"search"`
Filters []string `json:"filters"`
SortBy string `json:"sort_by"`
SortOrder string `json:"sort_order"`
}
DomainList is a page of the customer's domain portfolio.
type HostingAlias ¶ added in v0.2.0
type HostingAlias struct {
Name string `json:"name"`
OwnVhost bool `json:"own_vhost,omitempty"`
VhostDir string `json:"vhost_dir,omitempty"`
RFDomainID *int `json:"rf_domain_id"`
LinkedToApp bool `json:"linked_to_app,omitempty"`
}
HostingAlias is a domain alias of a hosting package.
type HostingBackup ¶ added in v0.2.0
type HostingBackup struct {
RecoverStatus *string `json:"recover_status"`
RecoverPointInTime *int64 `json:"recover_point_in_time"`
RecoveredAt *int64 `json:"recovered_at"`
}
HostingBackup is the state of a running or finished backup recovery.
type HostingDatabase ¶ added in v0.2.0
type HostingDatabase struct {
Name string `json:"name"`
User string `json:"user"`
Host string `json:"host,omitempty"`
}
HostingDatabase is a database of a hosting package. Credentials are never returned by the API — database passwords are available only in the dash.
type HostingPackage ¶ added in v0.2.0
type HostingPackage struct {
// ID is the package id, which is also the system user group of the package.
ID string `json:"id"`
WebhostID int `json:"webhost_id"`
Plan string `json:"plan"`
Generation int `json:"generation,omitempty"`
Status string `json:"status"`
Active bool `json:"active"`
Cancelled bool `json:"cancelled"`
PHPVersion string `json:"php_version,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
StartsAt *int64 `json:"starts_at"`
ExpiresAt *int64 `json:"expires_at"`
AliasCount int `json:"alias_count,omitempty"`
DatabaseCount int `json:"database_count,omitempty"`
Backup *HostingBackup `json:"backup,omitempty"`
}
HostingPackage is a web hosting package of the account.
type KeyKind ¶ added in v0.2.0
type KeyKind int
KeyKind classifies how the API evaluates a key's authorization.
const ( // KeyKindUnknown means no key metadata is available — the zero TokenInfo, // or one from a GetTokenInfo call that failed. KeyKindUnknown KeyKind = iota // KeyKindLegacy is a key created before RBAC: Permissions is nil and the // API grants it full access. KeyKindLegacy // KeyKindRBAC is a key with a permission list. The list may be empty, // which is a valid state meaning "nothing beyond GetTokenInfo and the // OpenAPI spec". KeyKindRBAC // KeyKindCapability is a scope-bound platform credential such as an ACME // DNS-01 key. The API restricts it to a fixed set of operations regardless // of its permission list, which is why such a key must never be read as a // legacy full-access key. KeyKindCapability )
type ListDomainsOptions ¶ added in v0.2.0
type ListDomainsOptions struct {
// Search matches the domain name, owner label or primary nameserver,
// case-insensitively and partially.
Search string
// Filters holds DomainFilter* values.
Filters []string
// SortBy holds a DomainSortBy* value.
SortBy string
// SortOrder is SortAsc or SortDesc.
SortOrder string
// Page is 1-based; 0 leaves the choice to the API.
Page int
// PageSize must be one of 10, 25, 50 or 100; 0 leaves the choice to the API.
PageSize int
}
ListDomainsOptions narrows and orders the result of ListDomains. The zero value requests the first page with the API's defaults.
type Nameservers ¶ added in v0.2.0
type Nameservers struct {
Domain string `json:"domain"`
// Mode is one of NameserverModeStandard, NameserverModeVanity or
// NameserverModeExternal.
Mode string `json:"mode"`
// Current holds the delegated nameservers, without a trailing dot.
Current []string `json:"current"`
// VanitySetID is nil unless the domain is delegated to a vanity set.
VanitySetID *int `json:"vanity_set_id"`
VanitySets []VanitySet `json:"vanity_sets"`
}
Nameservers describes the delegation of a domain.
type Option ¶ added in v0.2.0
type Option func(*Client)
Option customizes a Client created by NewClient.
func WithBaseURL ¶ added in v0.2.0
WithBaseURL overrides the API endpoint, e.g. "https://api.regfish.com".
func WithHTTPClient ¶ added in v0.2.0
WithHTTPClient sets the underlying HTTP client, for example to configure a custom transport, proxy or timeout.
func WithUserAgent ¶ added in v0.2.0
WithUserAgent overrides the User-Agent header sent with every request.
type PermissionReport ¶ added in v0.2.0
type PermissionReport struct {
// Token is the metadata the report was derived from.
Token TokenInfo
// Kind is Token.Kind(), lifted for convenience.
Kind KeyKind
// Scope is the capability scope, or "" for an ordinary key.
Scope string
// Requested holds the permissions that were checked, in the order given.
Requested []string
// Granted, Missing and Undetermined partition Requested.
//
// Undetermined is where a capability-scoped credential lands: it must clear
// a scope gate that permissions do not describe, so holding the permission
// does not mean the call will be allowed. An unpopulated TokenInfo lands
// there too. Gating a deployment on len(Missing) alone therefore passes a
// scope-bound key that cannot do the work — use Satisfied.
Granted []string
Missing []string
Undetermined []string
}
PermissionReport is the result of a startup permission check.
func (PermissionReport) Satisfied ¶ added in v0.2.0
func (r PermissionReport) Satisfied() bool
Satisfied reports whether every requested permission was positively confirmed — nothing missing and nothing undetermined.
It is the honest gate for a startup check. It is still only a statement about the key's permissions: Domain-Guardian rules, domain ownership, plan entitlements and quotas are invisible here, so a satisfied report is not a promise that a later call will succeed.
func (PermissionReport) String ¶ added in v0.2.0
func (r PermissionReport) String() string
String implements fmt.Stringer and renders a single log line naming the key, its kind and any missing permissions.
type Record ¶
type Record struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Data string `json:"data"`
TTL int `json:"ttl,omitempty"`
Priority *int `json:"priority,omitempty"`
Annotation *string `json:"annotation,omitempty"`
Tag *string `json:"tag,omitempty"`
Flags *int `json:"flags,omitempty"`
// Weight and Port belong to SRV records.
Weight *int `json:"weight,omitempty"`
Port *int `json:"port,omitempty"`
// Usage, Selector and MatchingType belong to TLSA records.
Usage *int `json:"usage,omitempty"`
Selector *int `json:"selector,omitempty"`
MatchingType *int `json:"matching_type,omitempty"`
// Auto reports whether the record is managed automatically by regfish.
// Read-only.
Auto bool `json:"auto"`
// Active reports whether the record is currently active. Read-only.
Active bool `json:"active"`
// TSCreated is the Unix timestamp of the record's creation. Read-only.
TSCreated int64 `json:"ts_created"`
// TSUpdated is the Unix timestamp of the record's last update. Read-only.
TSUpdated int64 `json:"ts_updated"`
}
Record represents a DNS record with common fields.
Name accepts a fully qualified name ("www.example.com."), a bare subdomain ("www") or "@" for the zone apex. Responses return the apex as "@" and all other names fully qualified.
Priority is required for MX records; Flags and Tag are required for CAA records. SRV records require Priority, Weight and Port, with Data holding the target host. TLSA records require Usage, Selector and MatchingType, with Data holding the certificate association data as hexadecimal digits. Targets in Data (MX, SRV, CNAME, ALIAS) must be fully qualified and end with a period. The fields below the write set (Auto, Active, TSCreated, TSUpdated) are read-only and ignored when a Record is sent to the API.
type TLSCertificate ¶ added in v0.2.0
type TLSCertificate struct {
ID string `json:"id"`
// Status is one of the TLSStatus* constants.
Status string `json:"status"`
CommonName string `json:"common_name"`
Product string `json:"product"`
Provider string `json:"provider"`
DNSNames []string `json:"dns_names"`
// ActionRequired reports whether the order needs further input before it
// can be submitted; CompletionURL and CompleteCertificate lead there.
ActionRequired bool `json:"action_required"`
PendingReason string `json:"pending_reason"`
PendingMessage string `json:"pending_message"`
CompletionURL string `json:"completion_url"`
OrganizationID *string `json:"organization_id"`
Organization *TLSCertificateOrganization `json:"organization,omitempty"`
OrderState string `json:"order_state,omitempty"`
RevocationScope string `json:"revocation_scope,omitempty"`
RevocationPendingScope string `json:"revocation_pending_scope,omitempty"`
ReissueSupported bool `json:"reissue_supported,omitempty"`
// ValidityDays is the purchased base order validity. On provider-linked
// renewals the issued lifetime can be longer — ValidFrom and ValidUntil
// are authoritative.
ValidityDays int `json:"validity_days,omitempty"`
RenewalBonusDays int `json:"renewal_bonus_days,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
ValidFrom string `json:"valid_from,omitempty"`
ValidUntil string `json:"valid_until,omitempty"`
ContractValidFrom string `json:"contract_valid_from,omitempty"`
ContractValidUntil string `json:"contract_valid_until,omitempty"`
LastStatusCheck string `json:"last_status_check,omitempty"`
CertificatePEMAvailable bool `json:"certificate_pem_available"`
OrderCancellable bool `json:"order_cancellable,omitempty"`
OrderCancellationMode string `json:"order_cancellation_mode,omitempty"`
OrderCancellableUntil string `json:"order_cancellable_until,omitempty"`
Validation *TLSValidation `json:"validation,omitempty"`
Reissue *TLSReissue `json:"reissue,omitempty"`
}
TLSCertificate is a TLS certificate order and, once issued, the certificate itself.
type TLSCertificateCancelRequest ¶ added in v0.2.0
type TLSCertificateCancelRequest struct {
// Note is stored with the cancellation request at the provider. regfish
// sends a default note when it is empty, because the CA requires one.
Note string `json:"note,omitempty"`
}
TLSCertificateCancelRequest is the optional payload of CancelCertificate.
type TLSCertificateDownload ¶ added in v0.2.0
type TLSCertificateDownload struct {
// Body is the PEM text or the ZIP bundle, depending on the format.
Body []byte
// ContentType is the MIME type reported by the API.
ContentType string
// Filename is taken from the Content-Disposition header, if present.
Filename string
}
TLSCertificateDownload is an issued certificate as returned by DownloadCertificate.
type TLSCertificateOrderCancelRequest ¶ added in v0.2.0
type TLSCertificateOrderCancelRequest struct {
Comment string `json:"comment,omitempty"`
RevocationReason string `json:"revocation_reason,omitempty"`
}
TLSCertificateOrderCancelRequest is the optional payload of CancelIssuedCertificateOrder.
type TLSCertificateOrganization ¶ added in v0.2.0
type TLSCertificateOrganization struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
// UsableForOrdering reports whether the organization can back a new order.
UsableForOrdering bool `json:"usable_for_ordering"`
}
TLSCertificateOrganization is the organization a certificate is bound to.
type TLSCertificateReissueRequest ¶ added in v0.2.0
type TLSCertificateReissueRequest struct {
CSR string `json:"csr"`
// CommonName is optional; when set it must match the current order exactly.
CommonName string `json:"common_name,omitempty"`
// DNSNames is optional; when set the SAN list must match the current order
// exactly.
DNSNames []string `json:"dns_names,omitempty"`
DCVMethod string `json:"dcv_method"`
Comments string `json:"comments,omitempty"`
// ValidityDays optionally requests a shorter replacement lifetime. The CA
// honors it only for eligible multi-year plan orders.
ValidityDays int `json:"validity_days,omitempty"`
}
TLSCertificateReissueRequest is the payload of ReissueCertificate.
type TLSCertificateRequest ¶ added in v0.2.0
type TLSCertificateRequest struct {
// SKU is one of the TLSProduct* constants.
SKU string `json:"sku"`
CommonName string `json:"common_name"`
DNSNames []string `json:"dns_names,omitempty"`
// CSR is the PEM encoded certificate signing request.
CSR string `json:"csr"`
// DCVMethod is DCVMethodDNSCNAMEToken or DCVMethodEmail.
DCVMethod string `json:"dcv_method"`
DCVEmails []string `json:"dcv_emails,omitempty"`
// OrgID references a TLS organization for OV and EV orders.
OrgID string `json:"org_id,omitempty"`
// RenewalOfCertificateID submits the order as a provider-linked renewal of
// the referenced certificate.
RenewalOfCertificateID string `json:"renewal_of_certificate_id,omitempty"`
// ValidityDays is the purchased base order validity, 1–199. Zero leaves
// the choice to the API (199).
ValidityDays int `json:"validity_days,omitempty"`
}
TLSCertificateRequest is the payload of CreateCertificate.
type TLSCertificateRevokeRequest ¶ added in v0.2.0
type TLSCertificateRevokeRequest struct {
Comment string `json:"comment,omitempty"`
// RevocationReason is one of the RevocationReason* constants and defaults
// to RevocationReasonUnspecified.
RevocationReason string `json:"revocation_reason,omitempty"`
}
TLSCertificateRevokeRequest is the optional payload of RevokeCertificate.
type TLSOrganization ¶ added in v0.2.0
type TLSOrganization struct {
ID string `json:"id"`
Organization string `json:"organization"`
// Status is TLSOrganizationStatusReady or TLSOrganizationStatusIncomplete.
Status string `json:"status"`
UsableForOrdering bool `json:"usable_for_ordering"`
Provider string `json:"provider,omitempty"`
ProviderStatus string `json:"provider_status,omitempty"`
ValidationStatus string `json:"validation_status,omitempty"`
ValidationType string `json:"validation_type,omitempty"`
ValidatedUntil string `json:"validated_until,omitempty"`
RevalidationRequired bool `json:"revalidation_required,omitempty"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Address string `json:"address"`
PostalCode string `json:"postal_code"`
City string `json:"city"`
CountryCode string `json:"country_code"`
Phone string `json:"phone"`
Email string `json:"email"`
}
TLSOrganization is an organization usable for OV and EV certificate orders.
type TLSOrganizationCreateRequest ¶ added in v0.2.0
type TLSOrganizationCreateRequest struct {
Organization string `json:"organization"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Address string `json:"address"`
PostalCode string `json:"postal_code"`
City string `json:"city"`
// CountryCode is a two letter ISO country code.
CountryCode string `json:"country_code"`
Phone string `json:"phone"`
Email string `json:"email"`
}
TLSOrganizationCreateRequest is the payload of CreateOrganization.
type TLSOrganizationPatchRequest ¶ added in v0.2.0
type TLSOrganizationPatchRequest struct {
// EditMode is TLSOrgEditModeCreateReplacement or
// TLSOrgEditModeUpdateProvider.
EditMode string `json:"edit_mode,omitempty"`
Organization string `json:"organization,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Address string `json:"address,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
City string `json:"city,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
}
TLSOrganizationPatchRequest is the payload of PatchOrganizationByID. At least one field must be set.
type TLSProduct ¶ added in v0.2.0
type TLSProduct struct {
SKU string `json:"sku"`
Name string `json:"name"`
// Type is "DV", "OV" or "EV".
Type string `json:"type"`
// ValidationLevel is the lower-case form of Type.
ValidationLevel string `json:"validation_level"`
OrganizationRequired bool `json:"organization_required"`
CA string `json:"ca"`
Price TLSProductPrice `json:"price"`
Recommended bool `json:"recommended,omitempty"`
Specs TLSProductSpecs `json:"specs"`
}
TLSProduct is an orderable certificate product.
type TLSProductPrice ¶ added in v0.2.0
TLSProductPrice is the account-specific price of a certificate product.
type TLSProductSpecs ¶ added in v0.2.0
type TLSProductSpecs struct {
Seal bool `json:"seal"`
SANSupport bool `json:"san_support"`
WWWOnApex bool `json:"www_on_apex"`
ApexOnWC bool `json:"apex_on_wc"`
WCSupport bool `json:"wc_support"`
SANWCSupport bool `json:"san_wc_support"`
MaxSANs int `json:"max_sans"`
MalwareCheck bool `json:"malware_check"`
}
TLSProductSpecs are the capabilities of a certificate product.
type TLSReissue ¶ added in v0.2.0
type TLSReissue struct {
ID int `json:"id"`
Status string `json:"status"`
CommonName string `json:"common_name"`
DNSNames []string `json:"dns_names"`
OrderState string `json:"order_state,omitempty"`
RequestedAt string `json:"requested_at,omitempty"`
LastUpdatedAt string `json:"last_updated_at,omitempty"`
Validation *TLSValidation `json:"validation,omitempty"`
}
TLSReissue is the state of a certificate reissue.
type TLSValidation ¶ added in v0.2.0
type TLSValidation struct {
// Method is DCVMethodDNSCNAMEToken or DCVMethodEmail.
Method string `json:"method"`
DNSRecords []TLSValidationDNSRecord `json:"dns_records,omitempty"`
EmailTargets []string `json:"email_targets,omitempty"`
}
TLSValidation describes how a certificate order is validated.
type TLSValidationDNSRecord ¶ added in v0.2.0
type TLSValidationDNSRecord struct {
Name string `json:"name"`
Type string `json:"type"`
Value string `json:"value"`
}
TLSValidationDNSRecord is a DNS record that has to be published to complete domain control validation.
type TokenInfo ¶ added in v0.2.0
type TokenInfo struct {
// KeyID is the public key id (the HASH part of the token).
KeyID string `json:"key_id"`
// TokenL4 holds the last 4 characters of the token, used as display id.
TokenL4 string `json:"token_l4"`
// Permissions is nil for legacy keys with full access, and an empty
// non-nil slice for an RBAC key that was granted nothing. The distinction
// is load-bearing; see Kind.
Permissions []string `json:"permissions"`
// Scope marks a special-purpose platform credential restricted to a fixed
// set of operations, e.g. ScopeACMEDNSChallenge. It is nil for ordinary
// customer keys.
Scope *string `json:"scope"`
// CustomerID is the regfish user id the key is scoped to.
CustomerID int `json:"customer_id"`
}
TokenInfo describes the API key a request authenticated with.
The three kinds of key it can describe — legacy, RBAC and capability-scoped — are distinguished by Kind. Do not read Permissions directly without consulting it: a nil slice and an empty slice mean opposite things, and a capability-scoped key has no permission list at all.
func ParseTokenInfo ¶ added in v0.2.0
ParseTokenInfo decodes a /meta/token payload.
Prefer it over a plain json.Unmarshal whenever you rehydrate cached token metadata: encoding/json leaves a field untouched when its member is absent, so a payload that lost its "permissions" member would decode to a nil slice and read as a legacy key with full access. ParseTokenInfo rejects that instead, because an absent list and an explicit null mean opposite things.
TokenInfo itself deliberately has no UnmarshalJSON method: a promoted one would silently swallow the sibling fields of any struct that embeds it.
func (TokenInfo) CheckPermissions ¶ added in v0.2.0
func (t TokenInfo) CheckPermissions(permissions ...string) PermissionReport
CheckPermissions compares the key metadata against the permissions a program intends to use. It performs no request; see Client.CheckPermissions.
func (TokenInfo) HasPermission ¶ added in v0.2.0
HasPermission reports whether the key may use the given permission. Legacy keys without a permission list are treated as having full access.
Note that HasPermission ignores Scope: a capability-scoped platform credential such as an ACME DNS-01 key has no permission list, so HasPermission reports true for every permission while the API refuses all but a handful of operations. It also reports true for a zero TokenInfo. Prefer Permits, which distinguishes both cases.
func (TokenInfo) IsLegacy ¶ added in v0.2.0
IsLegacy reports whether the key predates RBAC and therefore has full access.
func (TokenInfo) IsScopeLimited ¶ added in v0.2.0
IsScopeLimited reports whether the key is a scope-bound platform credential, restricted by the API to a fixed set of operations whatever its permissions.
func (TokenInfo) Kind ¶ added in v0.2.0
Kind reports how the API evaluates this key.
Scope wins over Permissions, mirroring the server, where the scope gate runs before the RBAC gate. A capability-scoped key carries no permission list, so testing Permissions first would read it as a legacy full-access key — exactly backwards.
func (TokenInfo) Permits ¶ added in v0.2.0
Permits reports what the library expects the API to decide for permission.
Unlike HasPermission it never claims access it cannot vouch for. A capability-scoped credential must clear the scope gate as well as the permission gate, and the scope gate is not described by any permission, so a permission it does hold yields DecisionUnknown rather than DecisionAllowed.
A permission list is authoritative in the other direction whatever the key's scope: the server runs its RBAC gate on every key that has a list, so a permission the list omits will be refused. That is why an absent permission reports DecisionDenied even for a scoped key.
Permits is advisory. Treat DecisionDenied as "do not bother" and DecisionAllowed as "probably", never as a reason to skip handling a denial.
type VanitySet ¶ added in v0.2.0
type VanitySet struct {
ID int `json:"id"`
Host string `json:"host"`
Nameservers []string `json:"nameservers"`
}
VanitySet is a set of vanity nameservers available on the account.
type ZoneCounts ¶ added in v0.2.0
type ZoneCounts struct {
RecordsTotal int `json:"records_total"`
RecordsActive int `json:"records_active"`
RecordsAuto int `json:"records_auto"`
RecordsManual int `json:"records_manual"`
ByType map[string]int `json:"by_type"`
}
ZoneCounts breaks down the records of a zone.
type ZoneDelegationNameserver ¶ added in v0.2.0
ZoneDelegationNameserver is one of the nameservers a zone is delegated to.
type ZoneDetail ¶ added in v0.2.0
type ZoneDetail struct {
ZoneSummary
DNSSEC DNSSEC `json:"dnssec"`
Counts ZoneCounts `json:"counts"`
Records []ZoneRecord `json:"records"`
}
ZoneDetail is a zone including its DNSSEC state and all of its records.
type ZoneRecord ¶ added in v0.2.0
type ZoneRecord struct {
ID int `json:"id"`
// Name is "@" for apex records and fully qualified otherwise.
Name string `json:"name"`
Type string `json:"type"`
Data string `json:"data"`
Priority *int `json:"priority,omitempty"`
Flags *int `json:"flags,omitempty"`
Tag string `json:"tag,omitempty"`
TTL int `json:"ttl"`
Auto bool `json:"auto"`
Active bool `json:"active"`
Annotation string `json:"annotation,omitempty"`
TSCreated int64 `json:"ts_created"`
TSUpdated int64 `json:"ts_updated"`
}
ZoneRecord is the superset record representation returned by the detailed zone endpoint. Unlike ListRecordsByDomain this includes NS records.
type ZoneSOA ¶ added in v0.2.0
type ZoneSOA struct {
PrimaryNameserver string `json:"primary_nameserver"`
Mailbox string `json:"mailbox"`
Serial int64 `json:"serial"`
Refresh int `json:"refresh"`
Retry int `json:"retry"`
Expire int `json:"expire"`
Minimum int `json:"minimum"`
TTL int `json:"ttl"`
}
ZoneSOA holds the SOA parameters of a zone.
type ZoneSummary ¶ added in v0.2.0
type ZoneSummary struct {
Domain string `json:"domain"`
Origin string `json:"origin"`
Active bool `json:"active"`
// Signed reports whether the regfish-hosted zone itself is signed.
Signed bool `json:"signed"`
// UsingRegfishNameservers reports whether the domain currently uses
// regfish authoritative nameservers.
UsingRegfishNameservers bool `json:"using_regfish_nameservers"`
DelegationNameservers []ZoneDelegationNameserver `json:"delegation_nameservers"`
SOA ZoneSOA `json:"soa"`
RecordCount int `json:"record_count"`
// DNSSECState is the high-level status: "active", "pending" or "inactive".
DNSSECState string `json:"dnssec_state"`
}
ZoneSummary describes a DNS zone without its records.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
create-record
command
Command create-record adds an A record and deletes it again, showing the basic create/read/delete cycle and how to read an API error.
|
Command create-record adds an A record and deletes it again, showing the basic create/read/delete cycle and how to read an API error. |
|
permission-check
command
Command permission-check inspects the API key and reports whether it can do what a program needs, so a misconfigured key fails at startup instead of during the first write.
|
Command permission-check inspects the API key and reports whether it can do what a program needs, so a misconfigured key fails at startup instead of during the first write. |
|
resilient-writer
command
Command resilient-writer shows the retry loop a long-running process needs.
|
Command resilient-writer shows the retry loop a long-running process needs. |
|
zone-export
command
Command zone-export prints a zone summary and writes the BIND export to stdout.
|
Command zone-export prints a zone summary and writes the BIND export to stdout. |