resource

package
v0.0.0-...-6f0f11f Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFound = fmt.Errorf("resource not found")

Functions

func ExtractRawToMap

func ExtractRawToMap(fieldName string, raw []byte) (map[string]interface{}, error)

func FromUnstructured

func FromUnstructured(obj *unstructured.Unstructured, v interface{}) error

func ToJson

func ToJson(obj runtime.Object) (gqlschema.JSON, error)

func ToStringPtr

func ToStringPtr(val interface{}) *string

func ToUnstructured

func ToUnstructured(v interface{}) (*unstructured.Unstructured, error)

Types

type Appendable

type Appendable interface {
	Append() interface{}
}

type Converter

type Converter interface {
	NewK8s() interface{}
}

type EventHandler

type EventHandler interface {
	K8sResource() interface{}
	ShouldNotify() bool
	Notify(gqlschema.SubscriptionEventType)
}

type EventHandlerProvider

type EventHandlerProvider func() EventHandler

type GenericService

type GenericService struct {
	ServiceBase
}

func (*GenericService) Delete

func (s *GenericService) Delete(name string, res runtime.Object) error

func (*GenericService) DeleteInNamespace

func (s *GenericService) DeleteInNamespace(namespace, name string, res runtime.Object) error

func (*GenericService) Get

func (s *GenericService) Get(name string, result interface{}) error

func (*GenericService) GetInNamespace

func (s *GenericService) GetInNamespace(name, namespace string, result interface{}) error

func (*GenericService) List

func (s *GenericService) List(result Appendable) error

func (*GenericService) ListInNamespace

func (s *GenericService) ListInNamespace(namespace string, result Appendable) error

func (*GenericService) UpdateInNamespace

func (s *GenericService) UpdateInNamespace(name, namespace string, result interface{}, update func() error) error

type GenericServiceFactory

type GenericServiceFactory struct {
	Client          dynamic.Interface
	InformerFactory dynamicinformer.DynamicSharedInformerFactory
}

func NewGenericServiceFactoryForConfig

func NewGenericServiceFactoryForConfig(config *rest.Config, informerResyncPeriod time.Duration) (*GenericServiceFactory, error)

func (*GenericServiceFactory) ForResource

type Listener

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

func NewListener

func NewListener(handler EventHandlerProvider) *Listener

func (*Listener) OnAdd

func (l *Listener) OnAdd(object interface{})

func (*Listener) OnDelete

func (l *Listener) OnDelete(object interface{})

func (*Listener) OnUpdate

func (l *Listener) OnUpdate(oldObject, newObject interface{})

type Module

type Module struct {
	*module.Pluggable
	// contains filtered or unexported fields
}

func NewModule

func NewModule(name string, factory *GenericServiceFactory, serviceCreators ServiceCreators) *Module

func (*Module) Disable

func (m *Module) Disable() error

func (*Module) Enable

func (m *Module) Enable() error

func (*Module) Service

type Notifier

type Notifier struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) AddListener

func (n *Notifier) AddListener(listener *Listener)

func (*Notifier) DeleteListener

func (n *Notifier) DeleteListener(listener *Listener)

func (*Notifier) OnAdd

func (n *Notifier) OnAdd(obj interface{})

func (*Notifier) OnDelete

func (n *Notifier) OnDelete(obj interface{})

func (*Notifier) OnUpdate

func (n *Notifier) OnUpdate(oldObj, newObj interface{})

type Service

type Service struct {
	Client   dynamic.NamespaceableResourceInterface
	Informer cache.SharedIndexInformer
	// contains filtered or unexported fields
}

func (*Service) AddIndexers

func (s *Service) AddIndexers(indexers cache.Indexers) error

func (*Service) FindInNamespace

func (s *Service) FindInNamespace(name, namespace string, result interface{}) error

func (*Service) ListInIndex

func (s *Service) ListInIndex(index, key string, results interface{}) error

type ServiceBase

type ServiceBase interface {
	ListByIndex(index, key string, result Appendable) error
	GetByKey(key string, result interface{}) error
	AddIndexers(indexers cache.Indexers) error
	Create(obj interface{}, result interface{}) error
	Apply(obj interface{}, result interface{}) error
	GVR() schema.GroupVersionResource
	DeleteInNamespace(name, namespace string) error
	Delete(name string) error
	Subscribe(handler EventHandlerProvider) (Unsubscribe, error)
}

type ServiceCreator

type ServiceCreator func(factory *GenericServiceFactory) (*GenericService, error)

type ServiceFactory

type ServiceFactory struct {
	Client          dynamic.Interface
	InformerFactory dynamicinformer.DynamicSharedInformerFactory
}

func NewServiceFactory

func NewServiceFactory(client dynamic.Interface, informerFactory dynamicinformer.DynamicSharedInformerFactory) *ServiceFactory

func NewServiceFactoryForConfig

func NewServiceFactoryForConfig(config *rest.Config, informerResyncPeriod time.Duration) (*ServiceFactory, error)

func (*ServiceFactory) ForResource

func (f *ServiceFactory) ForResource(gvr schema.GroupVersionResource) *Service

type Unsubscribe

type Unsubscribe func()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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