internal

package
v4.12.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRequest

type APIRequest struct {
	User    string `json:"user,omitempty"`
	Auth    string `json:"auth,omitempty"`
	Command string `json:"command,omitempty"`
	Data    any    `json:"data,omitempty"`
}

type APIResponse added in v4.12.0

type APIResponse[D any] struct {
	Response ResponsePayload[D] `json:"response"`
}

func (APIResponse[D]) GetCode added in v4.12.0

func (a APIResponse[D]) GetCode() int

func (APIResponse[D]) GetResult added in v4.12.0

func (a APIResponse[D]) GetResult() string

type Client

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

Client the API client for Webos.

func NewClient

func NewClient(username string, password string) *Client

NewClient creates a new Client.

func (*Client) AddRecord

func (c *Client) AddRecord(ctx context.Context, zone string, record DNSRow) error

AddRecord adds a record in the zone, either by updating existing records or creating new ones. https://kb.wedos.com/en/wapi-api-interface/wapi-command-dns-add-row/ https://kb.wedos.com/en/wapi-api-interface/wapi-command-dns-row-update/

func (*Client) Commit

func (c *Client) Commit(ctx context.Context, zone string) error

Commit not really required, all changes will be auto-committed after 5 minutes. https://kb.wedos.com/en/wapi-api-interface/wapi-command-dns-domain-commit/

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(ctx context.Context, zone string, recordID string) error

DeleteRecord deletes a record from the zone. If a record does not have an ID, it will be looked up. https://kb.wedos.com/en/wapi-api-interface/wapi-command-dns-row-delete/

func (*Client) GetRecords

func (c *Client) GetRecords(ctx context.Context, zone string) ([]DNSRow, error)

GetRecords lists all the records in the zone. https://kb.wedos.com/en/wapi-api-interface/wapi-command-dns-rows-list/

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

type DNSRow

type DNSRow struct {
	ID   string      `json:"ID,omitempty"`
	Name string      `json:"name,omitempty"`
	TTL  json.Number `json:"ttl,omitempty"`
	Type string      `json:"rdtype,omitempty"`
	Data string      `json:"rdata"`
}

type DNSRowRequest

type DNSRowRequest struct {
	ID     string      `json:"row_id,omitempty"`
	Domain string      `json:"domain,omitempty"`
	Name   string      `json:"name,omitempty"`
	TTL    json.Number `json:"ttl,omitempty"`
	Type   string      `json:"type,omitempty"`
	Data   string      `json:"rdata"`
}

type Response added in v4.12.0

type Response interface {
	GetCode() int
	GetResult() string
}

type ResponsePayload

type ResponsePayload[D any] struct {
	Code      int    `json:"code,omitempty"`
	Result    string `json:"result,omitempty"`
	Timestamp int    `json:"timestamp,omitempty"`
	SvTRID    string `json:"svTRID,omitempty"`
	Command   string `json:"command,omitempty"`
	Data      D      `json:"data"`
}

type Rows added in v4.12.0

type Rows struct {
	Rows []DNSRow `json:"row"`
}

Jump to

Keyboard shortcuts

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