Documentation
¶
Overview ¶
Package netcup implements a DNS record management client compatible with the libdns interfaces for netcup.
Index ¶
- 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, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
CustomerNumber string `json:"customer_number"`
APIKey string `json:"api_key"`
APIPassword string `json:"api_password"`
// contains filtered or unexported fields
}
Provider facilitates DNS record manipulation with netcup. CustomerNumber, APIKey and APIPassword have to be filled with the respective credentials from netcup. The netcup API requires a session ID for all requests, so at the beginning of each method call a login is performed to receive the session ID and at the end the session is stopped with a logout. The mutex locks concurrent access on all four implemented methods to make sure there is no race condition in the netcup zone and record configuration.
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. netcup records cannot have individual TTLs, there is one TTL for all records in the zone
For each input record, if no ID is given, the first record that matches the host name and type is searched. If none is found or the search result doesn't equal the input, a new one is appended. For MX records the priority is needed as an additional search parameter.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone. It returns the records that were deleted.
For each input record, if no ID is given, the first record that matches the host name and type is searched and deleted. For MX records the priority is needed as an additional search parameter. To be safe, the records to delete should include the IDs (for example from GetRecords)
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.
netcup records cannot have individual TTLs, there is one TTL for all records in the zone. So these can not be set.
For each input record, if no ID is given, the first record that matches the host name and type is searched. If none is found, the input is appended. If one is found, it is updated accordingly. For MX records the priority is needed as an additional search parameter.