Documentation
¶
Overview ¶
libdns client for IONOS DNS API
libdns implementation for IONOS DNS API. IONOS API documentaion: https://developer.hosting.ionos.de/docs/dns libdns: https://github.com/libdns/libdns
Index ¶
- Constants
- Variables
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zoneName string) ([]libdns.Record, error)
- func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
const (
APIEndpoint = "https://api.hosting.ionos.com/dns/v1"
)
Variables ¶
var ErrZoneNotAllowed = errors.New("zone is not in the configured allow-list")
ErrZoneNotAllowed is returned by write operations on a zone not listed in AllowedZones.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// AuthAPIToken is the IONOS Auth API token -
// see https://dns.ionos.com/api-docs#section/Authentication/Auth-API-Token
AuthAPIToken string `json:"auth_api_token"`
// AllowedZones optionally restricts write operations to the listed zones.
// Empty means no restriction. Read operations are unaffected.
AllowedZones []string `json:"allowed_zones,omitempty"`
}
Provider implements the libdns interfaces for IONOS
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords( ctx context.Context, zone string, records []libdns.Record, ) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords( ctx context.Context, zone string, records []libdns.Record, ) ([]libdns.Record, error)
DeleteRecords deletes the given records from the zone if they exist in the zone and exactly match the input. If the input records do not exist in the zone, they are silently ignored. DeleteRecords returns only the the records that were deleted, and does not return any records that were provided in the input but did not exist in the zone.
DeleteRecords only deletes records from the zone that *exactly* match the input records—that is, the name, type, TTL, and value all must be identical to a record in the zone for it to be deleted.
As a special case, you may leave any of the fields libdns.Record.Type, libdns.Record.TTL, or libdns.Record.Value empty ("", 0, and "" respectively). In this case, DeleteRecords will delete any records that match the other fields, regardless of the value of the fields that were left empty. Note that this behavior does *not* apply to the libdns.Record.Name field, which must always be specified.
Note that it is semantically invalid to remove the last “NS” record from a zone, so attempting to do is undefined behavior.
Implementations should return struct types defined by this package which correspond with the specific RR-type, rather than the [RR] struct, if possible.
Implementations must honor context cancellation and be safe for concurrent use.
libdns-ionos notes: we use ionosFindRecordsInZone to filter the records, which does not support TTL
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.