package directadmin import ( "github.com/rs/zerolog" ) // DNSContolActionType represents DNS control action type. type DNSControlActionType string const ( // DNSControlActionAdd represents "add" action for DNS control. DNSControlActionAdd DNSControlActionType = "add" // DNSControlActionEdit represents "edit" action for DNS control. DNSControlActionEdit DNSControlActionType = "edit" // DNSControlActionDelete represents "delete" action for DNS control. DNSControlActionDelete DNSControlActionType = "delete" ) // DNSControlRecordType represents DNS control record type. type DNSControlRecordType string const ( // DNSControlRecordTypeA represents DNS A record type for DNS control. DNSControlRecordTypeA DNSControlRecordType = "A" // DNSControlRecordTypeNS represents DNS NS record type for DNS control. DNSControlRecordTypeNS DNSControlRecordType = "NS" // DNSControlRecordTypeMX represents DNS MX record type for DNS control. DNSControlRecordTypeMX DNSControlRecordType = "MX" // DNSControlRecordTypeCNAME represents DNS CNAME record type for DNS control. DNSControlRecordTypeCNAME DNSControlRecordType = "CNAME" // DNSControlRecordTypePTR represents DNS PTR record type for DNS control. DNSControlRecordTypePTR DNSControlRecordType = "PTR" ) // DNSControlParams represents DNS control request params. type DNSControlParams struct { // Domain represents domain name from DirectAdmin panel. Domain string `schema:"domain"` // Action represents DNS control action type. Action DNSControlActionType `schema:"action"` // Type represents DNS record type. Type DNSControlRecordType `schema:"type"` // Name represents DNS record name. Name string `schema:"name"` // Value represents DNS record value. Value string `schema:"value"` // TTL represents DNS record time-to-live value. TTL *uint16 `schema:"ttl,omitempty"` // ARECS0 represents aresc0 DNS record query (required for DNS record editing and deleting). ARECS0 string `schema:"arecs0,omitempty"` } // MarshalZerologObject implements zerolog.LogObjectMarshaler. func (p *DNSControlParams) MarshalZerologObject(e *zerolog.Event) { e. Str("domain", p.Domain). Str("action", string(p.Action)). Str("type", string(p.Type)). Str("name", p.Name). Str("value", p.Value) if p.TTL != nil { e.Uint16("ttl", *p.TTL) } if p.ARECS0 != "" { e.Str("arecs0", p.ARECS0) } } // DNSControlResponse represents DNS control request response. type DNSControlResponse struct { // Error determines if error occurred during request processing. Error bool `schema:"error"` // Text represents request execution summary. Text string `schema:"text"` // Details represents additional information to request execution status. Details string `schema:"details"` } // MarshalZerologObject implements zerolog.LogObjectMarshaler. func (r *DNSControlResponse) MarshalZerologObject(e *zerolog.Event) { e. Bool("error", r.Error). Str("text", r.Text). Str("details", r.Details) } var ( _ zerolog.LogObjectMarshaler = &DNSControlParams{} _ zerolog.LogObjectMarshaler = &DNSControlResponse{} )