1package internal
2
3import "encoding/xml"
4
5// kasAPIEnvelope a KAS API request envelope.
6const kasAPIEnvelope = `
7<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
8    <Body>
9        <KasApi xmlns="https://kasserver.com/">
10            <Params>%s</Params>
11        </KasApi>
12    </Body>
13</Envelope>`
14
15// KasAPIResponseEnvelope a KAS envelope of the API response.
16type KasAPIResponseEnvelope struct {
17	XMLName xml.Name   `xml:"Envelope"`
18	Body    KasAPIBody `xml:"Body"`
19}
20
21type KasAPIBody struct {
22	KasAPIResponse *KasResponse `xml:"KasApiResponse"`
23	Fault          *Fault       `xml:"Fault"`
24}
25
26// ---
27
28type KasRequest struct {
29	// Login the relevant KAS login.
30	Login string `json:"kas_login,omitempty"`
31	// AuthType the authentication type.
32	AuthType string `json:"kas_auth_type,omitempty"`
33	// AuthData the authentication data.
34	AuthData string `json:"kas_auth_data,omitempty"`
35	// Action API function.
36	Action string `json:"kas_action,omitempty"`
37	// RequestParams Parameters to the API function.
38	RequestParams interface{} `json:"KasRequestParams,omitempty"`
39}
40
41type DNSRequest struct {
42	// ZoneHost the zone in question (must be a FQDN).
43	ZoneHost string `json:"zone_host"`
44	// RecordType the TYPE of the resource record (MX, A, AAAA etc.).
45	RecordType string `json:"record_type"`
46	// RecordName the NAME of the resource record.
47	RecordName string `json:"record_name"`
48	// RecordData the DATA of the resource record.
49	RecordData string `json:"record_data"`
50	// RecordAux the AUX of the resource record.
51	RecordAux int `json:"record_aux"`
52}
53
54// ---
55
56type GetDNSSettingsAPIResponse struct {
57	Response GetDNSSettingsResponse `json:"Response"  mapstructure:"Response"`
58}
59
60type GetDNSSettingsResponse struct {
61	KasFloodDelay float64      `json:"KasFloodDelay" mapstructure:"KasFloodDelay"`
62	ReturnInfo    []ReturnInfo `json:"ReturnInfo" mapstructure:"ReturnInfo"`
63	ReturnString  string       `json:"ReturnString"`
64}
65
66type ReturnInfo struct {
67	ID         interface{} `json:"record_id,omitempty" mapstructure:"record_id"`
68	Zone       string      `json:"record_zone,omitempty" mapstructure:"record_zone"`
69	Name       string      `json:"record_name,omitempty" mapstructure:"record_name"`
70	Type       string      `json:"record_type,omitempty" mapstructure:"record_type"`
71	Data       string      `json:"record_data,omitempty" mapstructure:"record_data"`
72	Changeable string      `json:"record_changeable,omitempty" mapstructure:"record_changeable"`
73	Aux        int         `json:"record_aux,omitempty" mapstructure:"record_aux"`
74}
75
76type AddDNSSettingsAPIResponse struct {
77	Response AddDNSSettingsResponse `json:"Response" mapstructure:"Response"`
78}
79
80type AddDNSSettingsResponse struct {
81	KasFloodDelay float64 `json:"KasFloodDelay" mapstructure:"KasFloodDelay"`
82	ReturnInfo    string  `json:"ReturnInfo" mapstructure:"ReturnInfo"`
83	ReturnString  string  `json:"ReturnString" mapstructure:"ReturnString"`
84}
85
86type DeleteDNSSettingsAPIResponse struct {
87	Response DeleteDNSSettingsResponse `json:"Response"`
88}
89
90type DeleteDNSSettingsResponse struct {
91	KasFloodDelay float64 `json:"KasFloodDelay"`
92	ReturnInfo    bool    `json:"ReturnInfo"`
93	ReturnString  string  `json:"ReturnString"`
94}
95