Documentation
¶
Overview ¶
Package pathtranslate exports api to transform given string slice into different forms in a schema aware manner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathTranslator ¶
type PathTranslator struct {
// contains filtered or unexported fields
}
PathTranslator stores the rules required to rewrite a given path as gNMI PathElem.
func NewPathTranslator ¶
func NewPathTranslator(schemaTree []*yang.Entry) (*PathTranslator, error)
NewPathTranslator instantiates a PathTranslator with the given slice of schemas. It returns an error if any of the keyed list schemas have the similar full path.
func (*PathTranslator) PathElem ¶
func (r *PathTranslator) PathElem(p []string) ([]*gnmipb.PathElem, error)
PathElem receives a path as string slice and generates slice of gNMI PathElem based on stored rewrite rules. It returns an error if there are less elements following the element's name in the path than the number of keys of the list.
func (*PathTranslator) SetWildcardKeys ¶ added in v0.30.0
func (r *PathTranslator) SetWildcardKeys(elems []*gnmipb.PathElem) (bool, error)
SetWildcardKeys sets the keys of the given path elements based on stored rewrite rules, with the value set to "*". Elems are modified in place. It returns true if the path has been updated, and an error if any of the elems already has keys.