xpath

package
v1.0.2-pre Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 4 Imported by: 0

README

Geneos XPath package

Documentation

Overview

Package to handle Geneos Gateway specific XPaths

These are a subset of the W3C XPath 1.0 standard and this package is only interested in absolute paths and no matching is done. Geneos XPaths are of a particular hierarchy and the ones we are interesting in here are those used to communicate with the Gateway REST command API.

The two types of path handled are for headline or table cells, which have the form:

/geneos/gateway/directory/probe/managedEntity/sampler/dataview/ ...

... headlines/cell or ... rows/row/cell

Each component except "geneos", "directory", "headlines" and "rows" can have a name and other predicates. The path can terminate at any level that can carry a name. Apart from names, only attributes in managedEntities are currently handled in anyway.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPath = errors.New("invalid Geneos XPath")

Functions

func SplitWithEscaping

func SplitWithEscaping(s string, separator, escape byte) []string

Types

type Column

type Column struct {
	Name string `json:"name,omitempty"`
}

type Dataview

type Dataview struct {
	Name string `json:"name,omitempty"`
}

type Entity

type Entity struct {
	Name       string            `json:"name,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

type Gateway

type Gateway struct {
	Name string `json:"name,omitempty"`
}

type Headline

type Headline struct {
	Name string `json:"name,omitempty"`
}

type Probe

type Probe struct {
	Name string `json:"name,omitempty"`
}

type Row

type Row struct {
	Name string `json:"name,omitempty"`
}

type Sampler

type Sampler struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

type XPath

type XPath struct {
	Gateway  *Gateway  `json:"gateway,omitempty"`
	Probe    *Probe    `json:"probe,omitempty"`
	Entity   *Entity   `json:"entity,omitempty"`
	Sampler  *Sampler  `json:"sampler,omitempty"`
	Dataview *Dataview `json:"dataview,omitempty"`
	Headline *Headline `json:"headline,omitempty"`
	Rows     bool      `json:"-"`
	Row      *Row      `json:"row,omitempty"`
	Column   *Column   `json:"column,omitempty"`
}

A Geneos Gateway XPath

Each field is a pointer, which if nil means the Xpath terminates at that point The "rows" boolean indicates in lower level components are headlines or rows

func New

func New() (x *XPath)

return a new XPath

func NewDataviewPath

func NewDataviewPath(dv string) (x *XPath)

return an xpath populated to the dataview, with name dv

func NewHeadlinePath

func NewHeadlinePath(headline string) (x *XPath)

return an xpath populated to the headline cell, identified by headline

func NewTableCellPath

func NewTableCellPath(row, column string) (x *XPath)

return an xpath populated to the table cell identifies by row and column

func Parse

func Parse(s string) (x *XPath, err error)

parse a string into a Geneos XPath structure or return an error very simplistic and hardwired to geneos absolute xpaths no support for embedded separators

func (*XPath) IsDataview

func (x *XPath) IsDataview() bool

func (*XPath) IsEmpty

func (x *XPath) IsEmpty() bool

return true is the XPath appears to be empty

func (*XPath) IsEntity

func (x *XPath) IsEntity() bool

func (*XPath) IsGateway

func (x *XPath) IsGateway() bool

func (*XPath) IsHeadline

func (x *XPath) IsHeadline() bool

func (*XPath) IsProbe

func (x *XPath) IsProbe() bool

func (*XPath) IsSampler

func (x *XPath) IsSampler() bool

func (*XPath) IsTableCell

func (x *XPath) IsTableCell() bool

func (*XPath) SetGatewayName

func (x *XPath) SetGatewayName(gateway string)

func (*XPath) String

func (x *XPath) String() (path string)

return a string representation of an XPath

Jump to

Keyboard shortcuts

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