providerclient

package
v0.0.0-...-958b214 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INCLUSTER           = "incluster"
	EXTERNAL            = "external"
	PROVIDER_CONFIG_KEY = "kubeconfig"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType string

EventType defines the possible types of events.

const (
	Added    EventType = "ADDED"
	Modified EventType = "MODIFIED"
	Deleted  EventType = "DELETED"
	Bookmark EventType = "BOOKMARK"
	Error    EventType = "ERROR"
)

type Options

type Options struct {
	// Parent is a name of parent space in space hierarchy.
	Parent string
}

Options are the possible options for provider create/delete operations.

type ProviderClient

type ProviderClient interface {
	Create(name string, opts Options) error
	Delete(name string, opts Options) error

	// List returns a list of spaces.
	// This method is used to discover the initial set of spaces
	// and to refresh the list of spaces periodically.
	ListSpaces() ([]SpaceInfo, error)

	// List returns a list of space names.
	// This method is used to discover the initial set of spaces
	// and to refresh the list of spaces periodically.
	ListSpacesNames() ([]string, error)

	// Get returns a space info.
	Get(name string) (SpaceInfo, error)

	// Watch returns a Watcher that watches for changes to a list of spaces
	// and react to potential changes.
	Watch() (Watcher, error)
}

Provider defines methods to retrieve, list, and watch fleet of spaces. The provider is responsible for discovering and managing the lifecycle of each space.

type SpaceInfo

type SpaceInfo struct {
	// Name is the name of the space.
	Name string

	// When accessing the space from within the cluster hosting the space
	// This relevant for space that is hosted in Pods and accessed from ther Pods in the same cluster
	Config map[string]string
}

SpaceInfo is a minimal space information.

type WatchEvent

type WatchEvent struct {
	// Type is the type of event that occurred.
	//
	// - ADDED or MODIFIED
	//	 	The space was added or updated: a new RESTConfig is available, or needs to be refreshed.
	// - DELETED
	// 		The space was deleted: the space is removed.
	// - ERROR
	// 		An error occurred while watching the space: the space is removed.
	// - BOOKMARK
	// 		A periodic event is sent that contains no new data: ignored.
	Type EventType

	// SpaceInfo is a minimal space information.
	SpaceInfo SpaceInfo

	// Name is the name of the space related to the event.
	Name string
}

WatchEvent is an event that is sent when a space is added, modified, or deleted.

type Watcher

type Watcher interface {
	// Stop stops watching. Will close the channel returned by ResultChan(). Releases
	// any resources used by the watch.
	Stop()

	// ResultChan returns a chan which will receive all the events. If an error occurs
	// or Stop() is called, the implementation will close this channel and
	// release any resources used by the watch.
	ResultChan() <-chan WatchEvent
}

Watcher watches for changes to spaces and provides events to a channel for the Manager to react to.

Jump to

Keyboard shortcuts

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