1package hostingde 2 3import "encoding/json" 4 5// APIError represents an error in an API response. 6// https://www.hosting.de/api/?json#warnings-and-errors 7type APIError struct { 8 Code int `json:"code"` 9 ContextObject string `json:"contextObject"` 10 ContextPath string `json:"contextPath"` 11 Details []string `json:"details"` 12 Text string `json:"text"` 13 Value string `json:"value"` 14} 15 16// Filter is used to filter FindRequests to the API. 17// https://www.hosting.de/api/?json#filter-object 18type Filter struct { 19 Field string `json:"field"` 20 Value string `json:"value"` 21} 22 23// Sort is used to sort FindRequests from the API. 24// https://www.hosting.de/api/?json#filtering-and-sorting 25type Sort struct { 26 Field string `json:"zoneName"` 27 Order string `json:"order"` 28} 29 30// Metadata represents the metadata in an API response. 31// https://www.hosting.de/api/?json#metadata-object 32type Metadata struct { 33 ClientTransactionID string `json:"clientTransactionId"` 34 ServerTransactionID string `json:"serverTransactionId"` 35} 36 37// ZoneConfig The ZoneConfig object defines a zone. 38// https://www.hosting.de/api/?json#the-zoneconfig-object 39type ZoneConfig struct { 40 ID string `json:"id"` 41 AccountID string `json:"accountId"` 42 Status string `json:"status"` 43 Name string `json:"name"` 44 NameUnicode string `json:"nameUnicode"` 45 MasterIP string `json:"masterIp"` 46 Type string `json:"type"` 47 EMailAddress string `json:"emailAddress"` 48 ZoneTransferWhitelist []string `json:"zoneTransferWhitelist"` 49 LastChangeDate string `json:"lastChangeDate"` 50 DNSServerGroupID string `json:"dnsServerGroupId"` 51 DNSSecMode string `json:"dnsSecMode"` 52 SOAValues *SOAValues `json:"soaValues,omitempty"` 53 TemplateValues json.RawMessage `json:"templateValues,omitempty"` 54} 55 56// SOAValues The SOA values object contains the time (seconds) used in a zone’s SOA record. 57// https://www.hosting.de/api/?json#the-soa-values-object 58type SOAValues struct { 59 Refresh int `json:"refresh"` 60 Retry int `json:"retry"` 61 Expire int `json:"expire"` 62 TTL int `json:"ttl"` 63 NegativeTTL int `json:"negativeTtl"` 64} 65 66// DNSRecord The DNS Record object is part of a zone. It is used to manage DNS resource records. 67// https://www.hosting.de/api/?json#the-record-object 68type DNSRecord struct { 69 ID string `json:"id,omitempty"` 70 ZoneID string `json:"zoneId,omitempty"` 71 RecordTemplateID string `json:"recordTemplateId,omitempty"` 72 Name string `json:"name,omitempty"` 73 Type string `json:"type,omitempty"` 74 Content string `json:"content,omitempty"` 75 TTL int `json:"ttl,omitempty"` 76 Priority int `json:"priority,omitempty"` 77 LastChangeDate string `json:"lastChangeDate,omitempty"` 78} 79 80// Zone The Zone Object. 81// https://www.hosting.de/api/?json#the-zone-object 82type Zone struct { 83 Records []DNSRecord `json:"records"` 84 ZoneConfig ZoneConfig `json:"zoneConfig"` 85} 86 87// ZoneUpdateRequest represents a API ZoneUpdate request. 88// https://www.hosting.de/api/?json#updating-zones 89type ZoneUpdateRequest struct { 90 BaseRequest 91 ZoneConfig `json:"zoneConfig"` 92 RecordsToAdd []DNSRecord `json:"recordsToAdd"` 93 RecordsToDelete []DNSRecord `json:"recordsToDelete"` 94} 95 96// ZoneUpdateResponse represents a response from the API. 97// https://www.hosting.de/api/?json#updating-zones 98type ZoneUpdateResponse struct { 99 BaseResponse 100 Response Zone `json:"response"` 101} 102 103// ZoneConfigsFindRequest represents a API ZonesFind request. 104// https://www.hosting.de/api/?json#list-zoneconfigs 105type ZoneConfigsFindRequest struct { 106 BaseRequest 107 Filter Filter `json:"filter"` 108 Limit int `json:"limit"` 109 Page int `json:"page"` 110 Sort *Sort `json:"sort,omitempty"` 111} 112 113// ZoneConfigsFindResponse represents the API response for ZoneConfigsFind. 114// https://www.hosting.de/api/?json#list-zoneconfigs 115type ZoneConfigsFindResponse struct { 116 BaseResponse 117 Response struct { 118 Limit int `json:"limit"` 119 Page int `json:"page"` 120 TotalEntries int `json:"totalEntries"` 121 TotalPages int `json:"totalPages"` 122 Type string `json:"type"` 123 Data []ZoneConfig `json:"data"` 124 } `json:"response"` 125} 126 127// BaseResponse Common response struct. 128// https://www.hosting.de/api/?json#responses 129type BaseResponse struct { 130 Errors []APIError `json:"errors"` 131 Metadata Metadata `json:"metadata"` 132 Warnings []string `json:"warnings"` 133 Status string `json:"status"` 134} 135 136// BaseRequest Common request struct. 137type BaseRequest struct { 138 AuthToken string `json:"authToken"` 139} 140