yandex360api

package
v0.0.0-...-e763b04 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrganizationContextKey  = RequestContextKey("organization")
	DomainEntriesContextKey = RequestContextKey("domainentries")
	DnsEntryContextKey      = RequestContextKey("dnsentry")
)
View Source
const ErrTemplate = `` /* 161-byte string literal not displayed */
View Source
const TXTDataKey = "txtdata"
View Source
const TXTKey = "TXT"

Variables

View Source
var Yandex360ApiMock_TestData = Yandex360ApiMockSettings{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type ApiClient

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

func NewApiClient

func NewApiClient() *ApiClient

func (*ApiClient) AddDnsRecord

func (a *ApiClient) AddDnsRecord(apiSettings *ApiSettings, record DnsRecord) error

func (*ApiClient) AddTxtRecord

func (a *ApiClient) AddTxtRecord(apiSettings *ApiSettings, name string, text string, ttl int) error

func (*ApiClient) DeleteDnsRecord

func (a *ApiClient) DeleteDnsRecord(apiSettings *ApiSettings, recordId int) error

func (*ApiClient) DeleteTxtRecordByName

func (a *ApiClient) DeleteTxtRecordByName(apiSettings *ApiSettings, name string) error

func (*ApiClient) GetDnsRecords

func (a *ApiClient) GetDnsRecords(apiSettings *ApiSettings) ([]DnsRecord, error)

type ApiSettings

type ApiSettings struct {
	ApiUrl         *url.URL
	Token          string
	OrganizationId int
	Domain         string
	TTL            int
}

type DnsRecord

type DnsRecord struct {
	Address    string `json:"address,omitempty"`
	Exchange   string `json:"exchange,omitempty"`
	Flag       int    `json:"flag,omitempty"`
	Name       string `json:"name" binding:"required"`
	Port       int    `json:"port,omitempty"`
	Preference int    `json:"preference,omitempty"`
	Priority   int    `json:"priority,omitempty"`
	RecordID   int    `json:"recordId"`
	Tag        string `json:"tag,omitempty"`
	Target     string `json:"target,omitempty"`
	Text       string `json:"text,omitempty"`
	TTL        int    `json:"ttl" binding:"required"`
	Type       string `json:"type" binding:"required"`
	Value      string `json:"value,omitempty"`
	Weight     int    `json:"weight,omitempty"`
}

type Domains

type Domains map[string]Records

type ErrorResponse

type ErrorResponse struct {
	Code    int `json:"code"`
	Details []struct {
		Type string `json:"@type"`
	} `json:"details"`
	Message string `json:"message"`
}

type GetDataResponse

type GetDataResponse struct {
	Page    int         `json:"page"`
	Pages   int         `json:"pages"`
	PerPage int         `json:"perPage"`
	Records []DnsRecord `json:"records"`
	Total   int         `json:"total"`
}

type Records

type Records []DnsRecord

type RequestContextKey

type RequestContextKey string

type Yandex360ApiMock

type Yandex360ApiMock struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Simplified API-mock

func NewYandex360ApiMock

func NewYandex360ApiMock(settings Yandex360ApiMockSettings) *Yandex360ApiMock

func (*Yandex360ApiMock) DnsCreateEntryHandler

func (y *Yandex360ApiMock) DnsCreateEntryHandler(w http.ResponseWriter, req *http.Request)

func (*Yandex360ApiMock) DnsDeleteRecordHandler

func (y *Yandex360ApiMock) DnsDeleteRecordHandler(w http.ResponseWriter, req *http.Request)

func (*Yandex360ApiMock) DnsListHandler

func (y *Yandex360ApiMock) DnsListHandler(w http.ResponseWriter, req *http.Request)

func (*Yandex360ApiMock) Run

func (y *Yandex360ApiMock) Run(addr string) error

func (*Yandex360ApiMock) RunDns

func (y *Yandex360ApiMock) RunDns(port string)

func (*Yandex360ApiMock) Stop

func (y *Yandex360ApiMock) Stop(ctx context.Context) error

func (*Yandex360ApiMock) StopDns

func (y *Yandex360ApiMock) StopDns(_ context.Context) error

type Yandex360ApiMockSettings

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

Jump to

Keyboard shortcuts

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