watcher

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAsyncSignalDisabled is returned from the Add/Remove functions if they
	// are called while async signal is disabled.
	ErrAsyncSignalDisabled = errors.New("async signal disabled")

	// ErrNoWatcher is returned from the Add/Remove functions if they are called
	// without a watcher in the context.
	ErrNoWatcher = errors.New("no watcher")
)

Functions

func Add

func Add(ctx context.Context, ref moRef, id string) (err error)

Add starts watching a container to which VirtualMachine resources may belong, such as a Folder, Cluster, ResourcePool, etc.

func DefaultWatchedPropertyPaths

func DefaultWatchedPropertyPaths() []string

DefaultWatchedPropertyPaths returns the default set of property paths to watch.

func JoinContext

func JoinContext(left, right context.Context) context.Context

JoinContext returns a new context that contains a reference to the functions object from the specified context. This function panics if the provided context does not contain a functions object. This function is thread-safe.

func NewContext

func NewContext() context.Context

NewContext returns a new context with a new functions object.

func Remove

func Remove(ctx context.Context, ref moRef, id string) (err error)

Remove stops watching a container to which VirtualMachine resources may belong, such as a Folder, Cluster, ResourcePool, etc.

func ValidateContext

func ValidateContext(ctx context.Context) bool

ValidateContext returns true if the provided context contains the functions object.

func WithContext

func WithContext(parent context.Context) context.Context

WithContext returns a new context with a new functions object.

Types

type LookupNamespacedNameResult

type LookupNamespacedNameResult struct {
	Namespace string
	Name      string

	// Verified indicates whether or not the VM's Kubernetes resource has the
	// vSphere VM's managed object ID in status.uniqueID.
	Verified bool

	// Deleted indicates whether the VM's Kubernetes resource has a
	// non-zero deletion timestamp.
	Deleted bool
}

LookupNamespacedNameResult is returned from a call to lookup the namespaced name of a vSphere VM.

type Result

type Result struct {
	// Namespace is the namespace to which the VirtualMachine resource belongs.
	Namespace string

	// Name is the name of the VirtualMachine resource.
	Name string

	// Ref is the ManagedObjectReference for the VM in vSphere.
	Ref moRef

	// Verified is true if the VirtualMachine resource identified by Namespace
	// and Name has already been verified to exist in this Kubernetes cluster.
	Verified bool
}

type Watcher

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

func Start

func Start(
	ctx context.Context,
	client *vim25.Client,
	watchedPropertyPaths []string,
	additionalIgnoredExtraConfigKeys []string,
	lookupNamespacedName lookupNamespacedNameFn,
	containerRefsWithIDs map[moRef][]string) (*Watcher, error)

Start begins watching a vSphere server for updates to VM Service managed VMs. If watchedPropertyPaths is nil, DefaultWatchedPropertyPaths will be used. The containerRefsWithIDs parameter may be used to start the watcher with an initial list of entities to watch.

func (*Watcher) Done

func (w *Watcher) Done() <-chan struct{}

Done returns a channel that is closed when the watcher is shutdown.

func (*Watcher) Err

func (w *Watcher) Err() error

Err returns the error that caused the watcher to stop.

func (*Watcher) Result

func (w *Watcher) Result() <-chan Result

Result returns a channel on which new results are received.

Jump to

Keyboard shortcuts

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