objectvisitor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTypedVisitor

type DefaultTypedVisitor interface {
	Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitor Visitor, visitDescendants bool) error
}

DefaultTypedVisitor is the default typed visitors.

type DefaultVisitor

type DefaultVisitor struct {
	// contains filtered or unexported fields
}

DefaultVisitor is the default implementation of Visitor.

func NewDefaultVisitor

func NewDefaultVisitor(dashConfig config.Dash, q queryer.Queryer, options ...DefaultVisitorOption) (*DefaultVisitor, error)

NewDefaultVisitor creates an instance of DefaultVisitor.

func (*DefaultVisitor) Visit

func (dv *DefaultVisitor) Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitDescendants bool) error

Visit visits a runtime.Object.

type DefaultVisitorOption

type DefaultVisitorOption func(*DefaultVisitor)

DefaultVisitorOption is an option for configuring DefaultVisitor.

func SetDefaultHandler

func SetDefaultHandler(dtv DefaultTypedVisitor) DefaultVisitorOption

SetDefaultHandler sets the default typed visitor for objects.

func SetTypedVisitors

func SetTypedVisitors(list []TypedVisitor) DefaultVisitorOption

SetTypedVisitors sets additional typed visitor for objects based on gvk.

type Ingress

type Ingress struct {
	// contains filtered or unexported fields
}

Ingress is a typed visitor for ingress objects.

func NewIngress

func NewIngress(q queryer.Queryer) *Ingress

NewIngress creates Ingress.

func (*Ingress) Supports

func (i *Ingress) Supports() schema.GroupVersionKind

Supports returns the gvk this typed visitor supports.

func (*Ingress) Visit

func (i *Ingress) Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitor Visitor, visitDescendants bool) error

Visit visits an ingress. It looks for associated services.

type Object

type Object struct {
	// contains filtered or unexported fields
}

Object is the default visitor for an object.

func NewObject

func NewObject(dashConfig config.Dash, q queryer.Queryer) *Object

NewObject creates Object.

func (*Object) Visit

func (o *Object) Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitor Visitor, visitDescendants bool) error

Visit visits an objects. It looks at immediate ancestors and descendants.

type ObjectHandler

type ObjectHandler interface {
	AddEdge(ctx context.Context, v1, v2 *unstructured.Unstructured) error
	Process(ctx context.Context, object *unstructured.Unstructured) error
}

ObjectHandler performs actions on an object. Can be used to augment visitor actions with extra functionality.

type Pod

type Pod struct {
	// contains filtered or unexported fields
}

Pod is a typed visitor for pods.

func NewPod

func NewPod(q queryer.Queryer) *Pod

NewPod creates an instance of Pod.

func (*Pod) Supports

func (p *Pod) Supports() schema.GroupVersionKind

Support returns the gvk this typed visitor supports.

func (*Pod) Visit

func (p *Pod) Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitor Visitor, visitDescendants bool) error

Visit visits a pod. It looks for service accounts and services.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a typed visitor for services.

func NewService

func NewService(q queryer.Queryer) *Service

NewService creates an instance of Service.

func (Service) Supports

func (Service) Supports() schema.GroupVersionKind

Supports returns the gvk this typed visitor supports.

func (*Service) Visit

func (s *Service) Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitor Visitor, visitDescendants bool) error

Visit visits a service. It looks for associated pods and ingresses.

type TypedVisitor

type TypedVisitor interface {
	DefaultTypedVisitor
	Supports() schema.GroupVersionKind
}

TypedVisitor is a typed visitor for a specific gvk.

type Visitor

type Visitor interface {
	Visit(ctx context.Context, object *unstructured.Unstructured, handler ObjectHandler, visitDescendants bool) error
}

Visitor is a visitor for cluster objects. It will visit an object and all of its ancestors and descendants.

Jump to

Keyboard shortcuts

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