search

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {

	// ListServers lists all known servers
	Search(ctx context.Context, serverID, query string, max int, objectType ObjectType) (ResultList, error)
}

Client defines method for interacting with the PowerDNS "Search" endpoints

func New

func New(hc *pdnshttp.Client) Client

New creates a new Search client

type ObjectType

type ObjectType int

ObjectType represents the object type for which a search should be performed

const (
	ObjectTypeAll ObjectType = iota
	ObjectTypeZone
	ObjectTypeRecord
	ObjectTypeComment
)

Possible object types; according to the PowerDNS documentation, this list is exhaustive.

func (ObjectType) String

func (t ObjectType) String() string

String makes this type implement fmt.Stringer

func (*ObjectType) UnmarshalJSON

func (t *ObjectType) UnmarshalJSON(b []byte) error

UnmarshalJSON makes this type implement json.Unmarshaler

type Result

type Result struct {
	Content    string     `json:"content"`
	Disabled   bool       `json:"disabled"`
	Name       string     `json:"name"`
	ObjectType ObjectType `json:"object_type"`
	ZoneID     string     `json:"zone_id"`
	Zone       string     `json:"zone"`
	Type       string     `json:"type"`
	TTL        int        `json:"ttl"`
}

Result represents a single search result. See the documentation for more information: https://doc.powerdns.com/authoritative/http-api/search.html#searchresult

type ResultList

type ResultList []Result

ResultList represents a list of search results. The type itself offers some advanced filtering functions for convenience.

func (ResultList) FilterBy

func (l ResultList) FilterBy(matcher func(*Result) bool) ResultList

FilterBy returns all elements of a result list that match a generic matcher function. The "matcher" function will be invoked for each element in the result list; if it returns true, the respective item will be included in the result list.

func (ResultList) FilterByObjectType

func (l ResultList) FilterByObjectType(t ObjectType) ResultList

FilterByObjectType returns all elements of a result list that are of a given object type.

func (ResultList) FilterByRecordType

func (l ResultList) FilterByRecordType(t string) ResultList

FilterByRecordType returns all elements of a result list that are a resource record and have a certain record type.

Jump to

Keyboard shortcuts

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