hostingde

package
v0.0.0-...-d25b310 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHostingdeBaseURL = "https://secure.hosting.de/api/dns/v1/json"
	DefaultHTTPNetBaseURL   = "https://partner.http.net/api/dns/v1/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code          int      `json:"code"`
	ContextObject string   `json:"contextObject"`
	ContextPath   string   `json:"contextPath"`
	Details       []string `json:"details"`
	Text          string   `json:"text"`
	Value         string   `json:"value"`
}

APIError represents an error in an API response. https://www.hosting.de/api/?json#warnings-and-errors

type BaseRequest

type BaseRequest struct {
	AuthToken string `json:"authToken"`
}

BaseRequest Common request struct.

type BaseResponse

type BaseResponse[T any] struct {
	Errors   []APIError `json:"errors"`
	Metadata Metadata   `json:"metadata"`
	Warnings []string   `json:"warnings"`
	Status   string     `json:"status"`
	Response T          `json:"response"`
}

BaseResponse Common response struct. base: https://www.hosting.de/api/?json#responses ZoneConfigsFind: https://www.hosting.de/api/?json#list-zoneconfigs ZoneUpdate: https://www.hosting.de/api/?json#updating-zones

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client the API client for Hosting.de.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates new Client.

func (Client) GetZone

func (c Client) GetZone(ctx context.Context, req ZoneConfigsFindRequest) (*ZoneConfig, error)

GetZone gets a zone.

func (Client) ListZoneConfigs

func (c Client) ListZoneConfigs(ctx context.Context, req ZoneConfigsFindRequest) (*ZoneResponse, error)

ListZoneConfigs lists zone configuration. https://www.hosting.de/api/?json#list-zoneconfigs

func (Client) UpdateZone

func (c Client) UpdateZone(ctx context.Context, req ZoneUpdateRequest) (*Zone, error)

UpdateZone updates a zone. https://www.hosting.de/api/?json#updating-zones

type DNSRecord

type DNSRecord struct {
	ID               string `json:"id,omitempty"`
	ZoneID           string `json:"zoneId,omitempty"`
	RecordTemplateID string `json:"recordTemplateId,omitempty"`
	Name             string `json:"name,omitempty"`
	Type             string `json:"type,omitempty"`
	Content          string `json:"content,omitempty"`
	TTL              int    `json:"ttl,omitempty"`
	Priority         int    `json:"priority,omitempty"`
	LastChangeDate   string `json:"lastChangeDate,omitempty"`
}

DNSRecord The DNS Record object is part of a zone. It is used to manage DNS resource records. https://www.hosting.de/api/?json#the-record-object

type Filter

type Filter struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

Filter is used to filter FindRequests to the API. https://www.hosting.de/api/?json#filter-object

type Metadata

type Metadata struct {
	ClientTransactionID string `json:"clientTransactionId"`
	ServerTransactionID string `json:"serverTransactionId"`
}

Metadata represents the metadata in an API response. https://www.hosting.de/api/?json#metadata-object

type SOAValues

type SOAValues struct {
	Refresh     int `json:"refresh"`
	Retry       int `json:"retry"`
	Expire      int `json:"expire"`
	TTL         int `json:"ttl"`
	NegativeTTL int `json:"negativeTtl"`
}

SOAValues The SOA values object contains the time (seconds) used in a zone’s SOA record. https://www.hosting.de/api/?json#the-soa-values-object

type Sort

type Sort struct {
	Field string `json:"zoneName"`
	Order string `json:"order"`
}

Sort is used to sort FindRequests from the API. https://www.hosting.de/api/?json#filtering-and-sorting

type Zone

type Zone struct {
	Records    []DNSRecord `json:"records"`
	ZoneConfig ZoneConfig  `json:"zoneConfig"`
}

Zone The Zone Object. https://www.hosting.de/api/?json#the-zone-object

type ZoneConfig

type ZoneConfig struct {
	ID                    string          `json:"id"`
	AccountID             string          `json:"accountId"`
	Status                string          `json:"status"`
	Name                  string          `json:"name"`
	NameUnicode           string          `json:"nameUnicode"`
	MasterIP              string          `json:"masterIp"`
	Type                  string          `json:"type"`
	EMailAddress          string          `json:"emailAddress"`
	ZoneTransferWhitelist []string        `json:"zoneTransferWhitelist"`
	LastChangeDate        string          `json:"lastChangeDate"`
	DNSServerGroupID      string          `json:"dnsServerGroupId"`
	DNSSecMode            string          `json:"dnsSecMode"`
	SOAValues             *SOAValues      `json:"soaValues,omitempty"`
	TemplateValues        json.RawMessage `json:"templateValues,omitempty"`
}

ZoneConfig The ZoneConfig object defines a zone. https://www.hosting.de/api/?json#the-zoneconfig-object

type ZoneConfigsFindRequest

type ZoneConfigsFindRequest struct {
	BaseRequest
	Filter Filter `json:"filter"`
	Limit  int    `json:"limit"`
	Page   int    `json:"page"`
	Sort   *Sort  `json:"sort,omitempty"`
}

ZoneConfigsFindRequest represents a API ZonesFind request. https://www.hosting.de/api/?json#list-zoneconfigs

type ZoneResponse

type ZoneResponse struct {
	Limit        int          `json:"limit"`
	Page         int          `json:"page"`
	TotalEntries int          `json:"totalEntries"`
	TotalPages   int          `json:"totalPages"`
	Type         string       `json:"type"`
	Data         []ZoneConfig `json:"data"`
}

type ZoneUpdateRequest

type ZoneUpdateRequest struct {
	BaseRequest
	ZoneConfig      `json:"zoneConfig"`
	RecordsToAdd    []DNSRecord `json:"recordsToAdd"`
	RecordsToDelete []DNSRecord `json:"recordsToDelete"`
}

ZoneUpdateRequest represents a API ZoneUpdate request. https://www.hosting.de/api/?json#updating-zones

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL