Documentation ¶
Index ¶
- type Details
- type Node
- type NodeIdentifier
- type Option
- type PackageNode
- type View
- func (v *View) Examples() map[schema.GroupVersionKind][]Node
- func (v *View) FileDetails() map[span.URI]*Details
- func (v *View) Meta() *meta.Meta
- func (v *View) MetaLocation() string
- func (v *View) Nodes() map[NodeIdentifier]Node
- func (v *View) ParseFile(ctx context.Context, path string) error
- func (v *View) XRClaimsRefs() map[schema.GroupVersionKind]schema.GroupVersionKind
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Details ¶
type Details struct { Body []byte NodeIDs map[NodeIdentifier]struct{} }
Details represent file specific details.
type Node ¶
type Node interface { GetAST() ast.Node GetFileName() string GetDependants() []NodeIdentifier GetGVK() schema.GroupVersionKind GetObject() runtime.Object }
A Node is a single object in the package workspace graph.
type NodeIdentifier ¶
type NodeIdentifier struct {
// contains filtered or unexported fields
}
NodeIdentifier is the unique identifier of a node in a workspace.
type Option ¶
type Option func(*Workspace)
Option represents an option that can be applied to Workspace.
func WithLogger ¶
WithLogger overrides the default logger for the Workspace with the supplied logger.
func WithPermissiveParser ¶
func WithPermissiveParser() Option
WithPermissiveParser lets the workspace parser just print warnings when a file or a document in a file cannot be parsed. This can be used when partial results are more important than correctness.
func WithPrinter ¶
func WithPrinter(p pterm.TextPrinter) Option
WithPrinter overrides the printer of the Workspace with the supplied printer. By default a Workspace has no printer.
type PackageNode ¶
type PackageNode struct {
// contains filtered or unexported fields
}
A PackageNode represents a concrete node in an xpkg. TODO(hasheddan): PackageNode should be refactored into separate implementations for each node type (e.g. XRD, Composition, CRD, etc.).
func (*PackageNode) GetAST ¶
func (p *PackageNode) GetAST() ast.Node
GetAST gets the YAML AST node for this package node.
func (*PackageNode) GetDependants ¶
func (p *PackageNode) GetDependants() []NodeIdentifier
GetDependants gets the set of nodes dependant on this node. TODO(hasheddan): this method signature may change depending on how we want to construct the node graph for a workspace.
func (*PackageNode) GetFileName ¶
func (p *PackageNode) GetFileName() string
GetFileName gets the name of the file for this node.
func (*PackageNode) GetGVK ¶
func (p *PackageNode) GetGVK() schema.GroupVersionKind
GetGVK returns the GroupVersionKind of this node.
func (*PackageNode) GetObject ¶
func (p *PackageNode) GetObject() runtime.Object
GetObject returns the runtime.Object for this node.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View represents the current processed view of the workspace.
func (*View) Examples ¶
func (v *View) Examples() map[schema.GroupVersionKind][]Node
Examples returns the View's Nodes corresponding to the files found under /examples.
func (*View) FileDetails ¶
FileDetails returns the map of file details found within the parsed workspace.
func (*View) MetaLocation ¶
MetaLocation returns the meta file's location (on disk) in the current View.
func (*View) ParseFile ¶
ParseFile parses all YAML objects at the given path and updates the workspace node cache.
func (*View) XRClaimsRefs ¶
func (v *View) XRClaimsRefs() map[schema.GroupVersionKind]schema.GroupVersionKind
XRClaimsRefs returns a map of XR GVK -> XRC GVK.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace provides APIs for interacting with the current project workspace.