autodns

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_S  string = "Success"
	STATUS_E  string = "Error"
	STATUS_N  string = "Notification"
	STATUS_EF string = "Error Function"

	ZONE_CREATE         string = "ZONE_CREATE"
	ZONE_UPDATE         string = "ZONE_UPDATE"
	ZONE_UPDATE_BULK    string = "ZONE_UPDATE_BULK"
	ZONE_INFO           string = "ZONE_INFO"
	ZONE_COMMENT_UPDATE string = "ZONE_COMMENT_UPDATE"
)
View Source
const (
	A     = RRType("A")
	AAAA  = RRType("AAAA")
	MX    = RRType("MX")
	CNAME = RRType("CNAME")
	NS    = RRType("NS")
	PTR   = RRType("PTR")
	TXT   = RRType("TXT")
	HINFO = RRType("HINFO")
	SPF   = RRType("SPF")
	SRV   = RRType("SRV")
	NAPTR = RRType("NAPTR")
)
View Source
const (
	DDMMYYYYhhmmss = "2006-01-02 15:04:05"
)
View Source
const DEFAULT_URL = "https://gateway.autodns.com"

Variables

View Source
var REQUIRED_ENV = []string{"AUTODNS_USER", "AUTODNS_PASSWORD", "AUTODNS_CONTEXT"}
View Source
var TASK_CODES = map[string]Code{
	ZONE_CREATE:         {Number: "0201"},
	ZONE_UPDATE:         {Number: "0202"},
	ZONE_UPDATE_BULK:    {Number: "0202001"},
	ZONE_INFO:           {Number: "0205"},
	ZONE_COMMENT_UPDATE: {Number: "0202004"},
}

Functions

func FormatTime

func FormatTime(time time.Time) string

func Time

func Time(value string) (time.Time, error)

func TimeInLocation

func TimeInLocation(value string, location *time.Location) (time.Time, error)

Types

type AllowTransferFrom

type AllowTransferFrom string

type Auth

type Auth struct {
	XMLName  xml.Name `xml:"auth"`
	Chardata string   `xml:",chardata"`
	User     string   `xml:"user"`
	Password string   `xml:"password"`
	Context  string   `xml:"context"`
}

type Callback

type Callback func(resp *http.Response, err error)

type Changed

type Changed string

type Client

type Client struct {
	Url      string
	Context  string
	SystemNs []SystemNameServer
	User     string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(user, password, context string, url string, sysNS []SystemNameServer) (*Client, error)

func NewClientFromEnv

func NewClientFromEnv() (*Client, error)

func NewLangClient added in v0.0.2

func NewLangClient(user, password, lang, context string, url string, sysNS []SystemNameServer) (*Client, error)

func (*Client) NewRequest added in v0.0.2

func (c *Client) NewRequest() (*Request, error)

func (*Client) PerformRequest

func (c *Client) PerformRequest(request *Request, callback Callback)

type Code

type Code struct {
	Number        string
	Status        string
	StatusMessage string
	Error         error
}

func GetValidCode

func GetValidCode(key string) (Code, error)

func (*Code) MarshalXML

func (code *Code) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Code) String

func (code *Code) String() string

func (*Code) UnmarshalXML

func (code *Code) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Comment

type Comment string

type Created

type Created string

type Data

type Data struct {
	Chardata string `xml:",chardata"`
	Zone     *Zone  `xml:"zone"`
}

type Default

type Default struct {
	Chardata              string            `xml:",chardata"`
	Comment               *Comment          `xml:"comment"`
	ResourceRecordAdds    []*ResourceRecord `xml:"rr_add"`
	ResourceRecordRemoves []*ResourceRecord `xml:"rr_rem"`
}

func NewTaskDefault

func NewTaskDefault() *Default

func (*Default) AddRecordAdd

func (d *Default) AddRecordAdd(rr *ResourceRecord) *Default

func (*Default) AddRecordRem

func (d *Default) AddRecordRem(rr *ResourceRecord) *Default

func (*Default) RemRecordAdd

func (d *Default) RemRecordAdd(rr *ResourceRecord) *Default

func (*Default) RemRecordRem

func (d *Default) RemRecordRem(rr *ResourceRecord) *Default

type Domainsafe

type Domainsafe string

type Free

type Free struct {
	XMLName  xml.Name `xml:"free"`
	Chardata string   `xml:",chardata"`
}

type Main

type Main struct {
	Chardata string `xml:",chardata"`
	Value    string `xml:"value"`
	Ttl      string `xml:"ttl"`
}

type Message

type Message struct {
	Chardata string   `xml:",chardata"`
	Text     []string `xml:"text"`
	Code     Code     `xml:"code"`
	Type     string   `xml:"type"`
	Object   struct {
		Chardata string `xml:",chardata"`
		Type     string `xml:"type"`
		Value    string `xml:"value"`
	} `xml:"object"`
}

type NameServer

type NameServer struct {
	XMLName  xml.Name `xml:"nserver"`
	Chardata string   `xml:",chardata"`
	Name     string   `xml:"name"`
	Ttl      string   `xml:"ttl,omitempty"`
}

type NsAction

type NsAction string

type NsGroup

type NsGroup string

type Owner

type Owner struct {
	XMLName  xml.Name `xml:"owner"`
	Chardata string   `xml:",chardata"`
	User     string   `xml:"user"`
	Context  string   `xml:"context"`
}

type PurgeType

type PurgeType string

type RRType

type RRType string

func NewRRType

func NewRRType(v string) (RRType, error)

func (*RRType) MarshalXML

func (rrType *RRType) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*RRType) UnmarshalXML

func (rrType *RRType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Request

type Request struct {
	XMLName  xml.Name `xml:"request"`
	Chardata string   `xml:",chardata"`
	Auth     *Auth
	Owner    *Owner
	Language string `xml:"language"`
	Task     *Task
}

func ParseRequest

func ParseRequest(data string) (*Request, error)

func (*Request) WithTask

func (r *Request) WithTask(task *Task) *Request

type ResourceRecord

type ResourceRecord struct {
	Chardata string  `xml:",chardata"`
	Name     string  `xml:"name"`
	Ttl      string  `xml:"ttl"`
	Type     *RRType `xml:"type"`
	Pref     string  `xml:"pref,omitempty"`
	Value    string  `xml:"value"`
}

func NewResourceRecord

func NewResourceRecord(params map[string]string) (*ResourceRecord, error)

func (*ResourceRecord) Hash

func (rr *ResourceRecord) Hash() string

type Response

type Response struct {
	XMLName  xml.Name `xml:"response"`
	Chardata string   `xml:",chardata"`
	Result   struct {
		Chardata string     `xml:",chardata"`
		Data     *Data      `xml:"data"`
		Status   *Status    `xml:"status"`
		Msg      []*Message `xml:"msg"`
	} `xml:"result"`
	StID string `xml:"stid"`
}

type Soa

type Soa struct {
	Chardata string `xml:",chardata"`
	Level    string `xml:"level,omitempty"`
	Refresh  string `xml:"refresh"`
	Retry    string `xml:"retry"`
	Expire   string `xml:"expire"`
	Ttl      string `xml:"ttl"`
	Email    string `xml:"email"`
	Default  string `xml:"default"`
}

type Status

type Status struct {
	Chardata string   `xml:",chardata"`
	Code     Code     `xml:"code"`
	Text     []string `xml:"text"`
	Type     string   `xml:"type"`
}

type SystemNameServer

type SystemNameServer string

type Task

type Task struct {
	XMLName  xml.Name `xml:"task"`
	Chardata string   `xml:",chardata"`
	Code     Code     `xml:"code"`
	Default  *Default `xml:"default"`
	Key      *TaskKey `xml:"key,omitempty"`
	Zone     *Zone    `xml:"zone"`
}

func NewTaskWithCode

func NewTaskWithCode(code Code) (*Task, error)

func NewTaskWithKey

func NewTaskWithKey(key string) (*Task, error)

func (*Task) WithDefault

func (t *Task) WithDefault(d *Default) *Task

func (*Task) WithZone

func (t *Task) WithZone(zone *Zone) *Task

type TaskKey

type TaskKey string

type User

type User struct {
	Chardata string `xml:",chardata"`
	User     string `xml:"user"`
	Context  string `xml:"context"`
}

type WwwInclude

type WwwInclude string

type Zone

type Zone struct {
	Chardata          string             `xml:",chardata"`
	Name              string             `xml:"name"`
	Changed           *Changed           `xml:"changed"`
	Created           *Created           `xml:"created"`
	SystemNs          *SystemNameServer  `xml:"system_ns"`
	NsAction          *NsAction          `xml:"ns_action"`
	WwwInclude        *WwwInclude        `xml:"www_include"`
	AllowTransferFrom *AllowTransferFrom `xml:"allow_transfer_from"`
	Main              *Main              `xml:"main"`
	Soa               *Soa               `xml:"soa"`
	NameServers       []*NameServer      `xml:"nserver"`
	ResourceRecords   []*ResourceRecord  `xml:"rr"`
	Free              []*Free            `xml:"free"`
	Domainsafe        *Domainsafe        `xml:"domainsafe"`
	Owner             *User              `xml:"owner"`
	UpdatedBy         *User              `xml:"updated_by"`
	NsGroup           *NsGroup           `xml:"ns_group"`
	PurgeType         *PurgeType         `xml:"purge_type"`
}

func NewZone

func NewZone(name string) (*Zone, error)

func (*Zone) WithFree

func (zone *Zone) WithFree(chardata string) *Zone

func (*Zone) WithMain

func (zone *Zone) WithMain(value string, ttl string) *Zone

func (*Zone) WithSystemNS

func (zone *Zone) WithSystemNS(sysNameServer SystemNameServer) *Zone

Jump to

Keyboard shortcuts

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