v1

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePayload

type BasePayload struct {
	Action RequestAction     `json:"action"`
	Params *NetcupBaseParams `json:"param"`
}

Base payload for all API requests, except for login().

type DnsRecord

type DnsRecord struct {
	Id           string `json:"id"`
	Hostname     string `json:"hostname"`
	Type         string `json:"type"`
	Priority     string `json:"priority"`
	Destination  string `json:"destination"`
	DeleteRecord bool   `json:"deleterecord"`
	State        string `json:"state"`
}

DnsRecord holds information about a single DNS record entry.

func (*DnsRecord) String

func (d *DnsRecord) String() string

Stringer implementation for DnsRecord

type DnsRecordSet

type DnsRecordSet struct {
	Content []DnsRecord `json:"dnsrecords"`
}

type DnsZoneData

type DnsZoneData struct {
	DomainName   string `json:"name"`
	Ttl          string `json:"ttl"`
	Serial       string `json:"serial"`
	Refresh      string `json:"refresh"`
	Retry        string `json:"retry"`
	Expire       string `json:"expire"`
	DnsSecStatus bool   `json:"dnssecstatus"`
}

DnsZoneData holds information about a DNS zone of a domain.

func (*DnsZoneData) String

func (d *DnsZoneData) String() string

Stringer implementation for DnsZoneData.

type InfoDnsRecordsParams

type InfoDnsRecordsParams InfoDnsZoneParams

Parameters for InfoDnsRecords

type InfoDnsRecordsPayload

type InfoDnsRecordsPayload struct {
	Action RequestAction         `json:"action"`
	Params *InfoDnsRecordsParams `json:"param"`
}

Payload for InfoDnsRecords request

type InfoDnsRecordsResponseData

type InfoDnsRecordsResponseData struct {
	DnsRecords []DnsRecord `json:"dnsrecords"`
}

type InfoDnsRecordsResponsePayload

type InfoDnsRecordsResponsePayload struct {
	NetcupBaseResponseMessage
	ResponseData *InfoDnsRecordsResponseData `json:"responsedata"`
}

type InfoDnsZoneParams

type InfoDnsZoneParams struct {
	NetcupBaseParams
	DomainName string `json:"domainname"`
}

Parameters for InfoDnsZone request

type InfoDnsZonePayload

type InfoDnsZonePayload struct {
	Action RequestAction      `json:"action"`
	Params *InfoDnsZoneParams `json:"param"`
}

Payload for InfoDnsZone request

type InfoDnsZoneResponsePayload

type InfoDnsZoneResponsePayload struct {
	NetcupBaseResponseMessage
	ResponseData *DnsZoneData `json:"responsedata,omitempty"`
}

Inner response data of InfoDnsZone response.

type LoginParams

type LoginParams struct {
	CustomerNumber  int    `json:"customernumber"`
	ApiKey          string `json:"apikey"`
	ApiPassword     string `json:"apipassword"`
	ClientRequestId string `json:"clientrequestid"`
}

Parameters used for login() request. These are special in the way they don't contain apisessionid field and contain apipassword initially.

type LoginPayload

type LoginPayload struct {
	Action RequestAction `json:"action"`
	Params *LoginParams  `json:"param"`
}

Payload used for login request

type LoginResponseData

type LoginResponseData struct {
	ApiSessionId string `json:"apisessionid"`
}

Inner resonse data of a login response.

type LoginResponsePayload

type LoginResponsePayload struct {
	NetcupBaseResponseMessage
	ResponseData *LoginResponseData `json:"responsedata"`
}

Response payload of a login response.

type NetcupBaseParams

type NetcupBaseParams struct {
	CustomerNumber  int    `json:"customernumber"`
	ApiSessionId    string `json:"apisessionid"`
	ApiKey          string `json:"apikey"`
	ClientRequestId string `json:"clientrequestid"`
}

This is what Netcup expects to be in "params" (except for login() request, which doesn't have ApiSessionId)

type NetcupBaseResponseMessage

type NetcupBaseResponseMessage struct {
	ServerRequestId string `json:"serverrequestid"`
	ClientRequestId string `json:"clientrequestid"`
	Action          string `json:"action"`
	Status          string `json:"status"`
	StatusCode      int    `json:"statuscode"`
	ShortMessage    string `json:"shortmessage"`
	LongMessage     string `json:"longmessage"`
}

Response message, as defined by the Netcup API. This is intentionally not complete, because the responseData can vary by any sub type of message.

func (*NetcupBaseResponseMessage) String

func (r *NetcupBaseResponseMessage) String() string

Stringer implementation for NetcupBaseResponseMessage.

type NetcupDnsClient

type NetcupDnsClient struct {
	// contains filtered or unexported fields
}

Holder for Netcup DNS client context.

func NewNetcupDnsClient

func NewNetcupDnsClient(customerNumber int, apiKey string, apiPassword string) *NetcupDnsClient

Creates a new client to interact with Netcup DNS API.

func NewNetcupDnsClientWithOptions

func NewNetcupDnsClientWithOptions(customerNumber int, apiKey string, apiPassword string, opts *NetcupDnsClientOptions) *NetcupDnsClient

Create a new client to interact with Netcup DNS API, using own given clientRequestId.

func (*NetcupDnsClient) Login

func (c *NetcupDnsClient) Login() (*NetcupSession, error)

Login to Netcup API. Returns a valid NetcupSession or error.

type NetcupDnsClientOptions

type NetcupDnsClientOptions struct {
	ClientRequestId string
	ApiEndpoint     string // useful for testing
}

Additional optional flags for client creation

type NetcupSession

type NetcupSession struct {
	LastResponse *NetcupBaseResponseMessage
	// contains filtered or unexported fields
}

Netcup session context object to hold session information, like apiSessionId or last response.

func (*NetcupSession) InfoDnsRecords

func (s *NetcupSession) InfoDnsRecords(domainName string) (*[]DnsRecord, error)

Query information about all DNS records.

func (*NetcupSession) InfoDnsZone

func (s *NetcupSession) InfoDnsZone(domainName string) (*DnsZoneData, error)

Query information about DNS zone.

func (*NetcupSession) Logout

func (s *NetcupSession) Logout() error

Logout from active Netcup session. This may return an error (which can be ignored).

func (*NetcupSession) String

func (s *NetcupSession) String() string

Stringer implementation for NetcupSession.

func (*NetcupSession) UpdateDnsRecords

func (s *NetcupSession) UpdateDnsRecords(domainName string, dnsRecordSet *[]DnsRecord) (*[]DnsRecord, error)

Update set of DNS records for a given domain name, returning updated DNS records.

func (*NetcupSession) UpdateDnsZone

func (s *NetcupSession) UpdateDnsZone(domainName string, dnsZone *DnsZoneData) (*DnsZoneData, error)

Update data of a DNS zone, returning an updated DnsZoneData.

type RequestAction

type RequestAction string

Type for action field of a request payload

type ResponseStatus added in v1.0.2

type ResponseStatus string

type for status

const (
	StatusSuccess ResponseStatus = "success"
	StatusError   ResponseStatus = "error"
	StatusStarted ResponseStatus = "started"
	StatusPending ResponseStatus = "pending"
	StatusWarning ResponseStatus = "warning"
)

type UpdateDnsRecordsParams

type UpdateDnsRecordsParams struct {
	NetcupBaseParams
	DomainName string        `json:"domainname"`
	DnsRecords *DnsRecordSet `json:"dnsrecordset"`
}

type UpdateDnsRecordsPayload

type UpdateDnsRecordsPayload struct {
	Action RequestAction           `json:"action"`
	Params *UpdateDnsRecordsParams `json:"param"`
}

type UpdateDnsRecordsResponseData

type UpdateDnsRecordsResponseData struct {
	DnsRecords []DnsRecord `json:"dnsrecords"`
}

type UpdateDnsRecordsResponsePayload

type UpdateDnsRecordsResponsePayload struct {
	NetcupBaseResponseMessage
	ResponseData *UpdateDnsRecordsResponseData `json:"responsedata"`
}

Response payload sent by Netcup upon updateDnsRecords() request

type UpdateDnsZoneParams

type UpdateDnsZoneParams struct {
	NetcupBaseParams
	DomainName string       `json:"domainname"`
	DnsZone    *DnsZoneData `json:"dnszone"`
}

type UpdateDnsZonePayload

type UpdateDnsZonePayload struct {
	Action RequestAction        `json:"action"`
	Params *UpdateDnsZoneParams `json:"param"`
}

Payload for UpdateDnsZone request

type UpdateDnsZoneResponsePayload

type UpdateDnsZoneResponsePayload InfoDnsZoneResponsePayload

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳