# README

parsers

import "github.com/SuperBuker/terraform-provider-dns-he-net/client/parsers"

Parsers contains functions to parse the response from the server.

Index

Constants

const (
    // accountQ is the XPath query for the account field.
    accountQ = "//form[@name='remove_domain']/input[@name='account']"

    // loginOkQ is the XPath query for the logout hyperlink.
    loginOkQ = "//a[@id='_tlogout']"

    // loginOtpQ is the XPath query for the OTP form.
    loginOtpQ = "//input[@id='tfacode']"

    // loginNoAuthQ is the XPath query for the login form.
    loginNoAuthQ = "//form[@name='login']"

    // zonesTableQ is the XPath query for the zones table.
    zonesTableQ = "//table[@id='domains_table']"

    // zoneQ is the XPath query for the zone rows.
    zoneQ = zonesTableQ + "/tbody/tr"

    // zoneIDQ is the XPath query for the zone ID within the zone row.
    zoneIDQ = "//td[@style]/img[@name][@value]"

    // recordsTableQ is the XPath query for the records table.
    recordsTableQ = "//div[@id='dns_main_content']/table[@class='generictable']"

    // recordQ is the XPath query for the record rows.
    recordQ = recordsTableQ + "/tbody/tr[@class]"

    // statusQ is the XPath query for the status message.
    statusQ = "//div[@id='dns_status']"

    // errorQ is the XPath query for the error message.
    errorQ = "//div[@id='dns_err']"
)

func GetAccount

func GetAccount(doc *html.Node) (string, error)

GetAccount returns the account name from the HTML body.

func GetRecords

func GetRecords(doc *html.Node) ([]models.Record, error)

GetRecords returns the records from the HTML body.

func GetStatusMessage

func GetStatusMessage(doc *html.Node) (models.StatusMessage, error)

GetStatusMessage returns the status message from the HTML body.

func GetZones

func GetZones(doc *html.Node) ([]models.Zone, error)

GetZones returns the zones from the HTML body.

func LoginStatus

func LoginStatus(doc *html.Node) auth.Status

LoginStatus returns the login status from the HTML body.

func ParseError

func ParseError(doc *html.Node) (issues []string)

ParseError returns the error message from the HTML body.

func ParseStatus

func ParseStatus(doc *html.Node) string

ParseStatus returns the dns status from the HTML body.

func errParsingNode

func errParsingNode(path, field string, err error) error

errParsingNode returns a tailored ErrParsing error.

func parseRecordNode

func parseRecordNode(node *html.Node) (record models.Record, err error)

parseRecordNode parses a record node.

func parseZoneNode

func parseZoneNode(node *html.Node) (models.Zone, error)

parseZoneNode parses a zone node.

type ErrNotFound

ErrNotFound is returned when the element is not found in the document.

type ErrNotFound struct {
    XPath string
}

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

func (*ErrNotFound) Unwrap

func (e *ErrNotFound) Unwrap() []error

type ErrParsing

ErrParsing is returned when an error happens when parsing the document.

type ErrParsing struct {
    XPath string
    Err   error
}

func (*ErrParsing) Error

func (e *ErrParsing) Error() string

func (*ErrParsing) Unwrap

func (e *ErrParsing) Unwrap() []error

type loginStatusQuery

loginStatusQuery is the query to find the login status.

type loginStatusQuery struct {
    status auth.Status
    query  string
}

func getLoginStatusTuples

func getLoginStatusTuples() []loginStatusQuery

getLoginStatusTuples returns the login status tuples.

Generated by gomarkdoc