resource

package
v0.1.67 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPathElem

func AddPathElem(p *config.Path, e *container.Entry) *config.Path

func DeepCopyConfigPath

func DeepCopyConfigPath(in *config.Path) *config.Path

Types

type HeInfo

type HeInfo struct {
	Name string `json:"name,omitempty"`
	Key  string `json:"key,omitempty"`
	Type string `json:"type,omitempty"`
}

type Option

type Option func(g *Resource)

Option can be used to manipulate Options.

func WithDependsOn

func WithDependsOn(d *Resource) Option

func WithExclude

func WithExclude(p string) Option

func WithXPath

func WithXPath(p string) Option

type Resource

type Resource struct {
	Path               *config.Path                   // relative path from the resource; the absolute path is assembled using the resurce hierarchy with dependsOn
	ActualPath         *config.Path                   // ActualPath is a relative path from the resource with the actual key information; the absolute path is assembled using the resurce hierarchy with dependsOn
	DependsOn          *Resource                      // resource dependency
	Excludes           []*config.Path                 // relative from the the resource
	FileName           string                         // the filename the resource is using to render out the config
	ResFile            *os.File                       // the file reference for writing the resource file
	RootContainerEntry *container.Entry               // this is the root element which is used to reference the hierarchical resource information
	Container          *container.Container           // root container of the resource
	LastContainerPtr   *container.Container           // pointer to the last container we process
	ContainerList      []*container.Container         // List of all containers within the resource
	ContainerLevel     int                            // the current container Level when processing the yang entries
	ContainerLevelKeys map[int][]*container.Container // the current container Level key list
	LocalLeafRefs      []*parser.LeafRef
	ExternalLeafRefs   []*parser.LeafRef
	// contains filtered or unexported fields
}

func NewResource

func NewResource(opts ...Option) *Resource

func (*Resource) AddExternalLeafRef

func (r *Resource) AddExternalLeafRef(ll, rl *config.Path)

func (*Resource) AddLocalLeafRef

func (r *Resource) AddLocalLeafRef(ll, rl *config.Path)

func (*Resource) AssignFileName

func (r *Resource) AssignFileName(prefix, suffix string)

func (*Resource) CloseFile

func (r *Resource) CloseFile() error

func (*Resource) CreateFile

func (r *Resource) CreateFile(dir, subdir1, subdir2 string) (err error)

func (*Resource) GetAbsoluteGnmiActualResourcePath

func (r *Resource) GetAbsoluteGnmiActualResourcePath() *config.Path

root resource have a additional entry in the path which is inconsistent with hierarchical resources to provide consistency we introduced this method to provide a consistent result for paths used mainly for leafrefs for now

func (*Resource) GetAbsoluteGnmiPath

func (r *Resource) GetAbsoluteGnmiPath() *config.Path

func (*Resource) GetAbsoluteLevel

func (r *Resource) GetAbsoluteLevel() int

func (*Resource) GetAbsoluteName

func (r *Resource) GetAbsoluteName() string

func (*Resource) GetAbsoluteXPath

func (r *Resource) GetAbsoluteXPath() *string

func (*Resource) GetAbsoluteXPathWithoutKey

func (r *Resource) GetAbsoluteXPathWithoutKey() *string

func (*Resource) GetActualGnmiFullPath

func (r *Resource) GetActualGnmiFullPath() *config.Path

func (*Resource) GetExcludeRelativeXPath

func (r *Resource) GetExcludeRelativeXPath() []string

func (*Resource) GetExternalLeafRef

func (r *Resource) GetExternalLeafRef() []*parser.LeafRef

func (*Resource) GetHierarchicalElements

func (r *Resource) GetHierarchicalElements() []*HeInfo

func (*Resource) GetInternalHierarchicalPaths

func (r *Resource) GetInternalHierarchicalPaths() []*config.Path

func (*Resource) GetLocalLeafRef

func (r *Resource) GetLocalLeafRef() []*parser.LeafRef

func (*Resource) GetPath

func (r *Resource) GetPath() *config.Path

GetPath returns the relative Path of the resource For the root resources we need to strip the first entry of the path since srl uses some prefix entry

func (*Resource) GetRelativeGnmiActualResourcePath

func (r *Resource) GetRelativeGnmiActualResourcePath() *config.Path

root resource have a additional entry in the path which is inconsistent with hierarchical resources to provide consistencyw e introduced this method to provide a consistent result for paths used mainly for leafrefs for now

func (*Resource) GetRelativeGnmiPath

func (r *Resource) GetRelativeGnmiPath() *config.Path

func (*Resource) GetRelativeXPath

func (r *Resource) GetRelativeXPath() *string

func (*Resource) GetResourceNameWithPrefix

func (r *Resource) GetResourceNameWithPrefix(prefix string) string

func (*Resource) GetRootContainerEntry

func (r *Resource) GetRootContainerEntry() *container.Entry

func (*Resource) ResourceLastElement

func (r *Resource) ResourceLastElement() string

func (*Resource) SetRootContainerEntry

func (r *Resource) SetRootContainerEntry(e *container.Entry)

Jump to

Keyboard shortcuts

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