clustermanager

package
v1.87.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DetailsAuthKey = "auth"

The details key used to provide auth information

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDBClusterStorage

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

func (*BoltDBClusterStorage) AddIfNotExists

func (cs *BoltDBClusterStorage) AddIfNotExists(key string, cluster []byte) error

Adds the entry if the key does not exist

func (*BoltDBClusterStorage) AddOrUpdate

func (cs *BoltDBClusterStorage) AddOrUpdate(key string, cluster []byte) error

Adds the encoded cluster to storage if it doesn't exist. Otherwise, update the existing value with the provided.

func (*BoltDBClusterStorage) Close

func (cs *BoltDBClusterStorage) Close() error

Closes the backing storage

func (*BoltDBClusterStorage) Each

func (cs *BoltDBClusterStorage) Each(handler func(string, []byte) error) error

Iterates through all key/values for the storage and calls the handler func. If a handler returns an error, the iteration stops.

func (*BoltDBClusterStorage) Remove

func (cs *BoltDBClusterStorage) Remove(key string) error

Removes a key from the cluster storage

type ClusterConfigEntry

type ClusterConfigEntry struct {
	Name    string                  `yaml:"name"`
	Address string                  `yaml:"address"`
	Auth    *ClusterConfigEntryAuth `yaml:"auth,omitempty"`
	Details map[string]interface{}  `yaml:"details,omitempty"`
}

Cluster definition from a configuration yaml

type ClusterConfigEntryAuth added in v1.75.0

type ClusterConfigEntryAuth struct {
	// The type of authentication provider to use
	Type string `yaml:"type"`

	// Data expressed as a secret
	SecretName string `yaml:"secretName,omitempty"`

	// Any data specifically needed by the auth provider
	Data string `yaml:"data,omitempty"`

	// User and Password as a possible input
	User string `yaml:"user,omitempty"`
	Pass string `yaml:"pass,omitempty"`
}

Authentication Information

type ClusterDefinition

type ClusterDefinition struct {
	ID      string                 `json:"id,omitempty"`
	Name    string                 `json:"name"`
	Address string                 `json:"address"`
	Details map[string]interface{} `json:"details,omitempty"`
}

ClusterDefinition

type ClusterManager

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

func NewClusterManager

func NewClusterManager(storage ClusterStorage) *ClusterManager

Creates a new ClusterManager instance using the provided storage

func NewConfiguredClusterManager

func NewConfiguredClusterManager(storage ClusterStorage, config string) *ClusterManager

Creates a new ClusterManager instance using the provided storage and populates a yaml configured list of clusters

func (*ClusterManager) Add

Adds, but will not update an existing entry.

func (*ClusterManager) AddOrUpdate

func (cm *ClusterManager) AddOrUpdate(cluster ClusterDefinition) (*ClusterDefinition, error)

func (*ClusterManager) Close

func (cm *ClusterManager) Close() error

func (*ClusterManager) GetAll

func (cm *ClusterManager) GetAll() []*ClusterDefinition

func (*ClusterManager) Remove

func (cm *ClusterManager) Remove(id string) error

type ClusterManagerEndpoints

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

func NewClusterManagerEndpoints

func NewClusterManagerEndpoints(manager *ClusterManager) *ClusterManagerEndpoints

func (*ClusterManagerEndpoints) DeleteCluster

func (*ClusterManagerEndpoints) GetAllClusters

func (cme *ClusterManagerEndpoints) GetAllClusters(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*ClusterManagerEndpoints) PutCluster

type ClusterStorage

type ClusterStorage interface {
	// Add only if the key does not exist
	AddIfNotExists(key string, cluster []byte) error

	// Adds the encoded cluster to storage if it doesn't exist. Otherwise, update the existing
	// value with the provided.
	AddOrUpdate(key string, cluster []byte) error

	// Removes a key from the cluster storage
	Remove(key string) error

	// Iterates through all key/values for the storage and calls the handler func. If a handler returns
	// an error, the iteration stops.
	Each(handler func(string, []byte) error) error

	// Closes the backing storage
	Close() error
}

ClusterStorage interface defines an implementation prototype for a storage responsible for ClusterDefinition instances

func NewBoltDBClusterStorage

func NewBoltDBClusterStorage(bucket string, db *bolt.DB) (ClusterStorage, error)

func NewMapDBClusterStorage

func NewMapDBClusterStorage() ClusterStorage

type DataEnvelope

type DataEnvelope struct {
	Code   int         `json:"code"`
	Status string      `json:"status"`
	Data   interface{} `json:"data"`
}

DataEnvelope is a generic wrapper struct for http response data

type MapDBClusterStorage

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

func (*MapDBClusterStorage) AddIfNotExists

func (cs *MapDBClusterStorage) AddIfNotExists(key string, cluster []byte) error

Adds the entry if the key does not exist

func (*MapDBClusterStorage) AddOrUpdate

func (cs *MapDBClusterStorage) AddOrUpdate(key string, cluster []byte) error

Adds the encoded cluster to storage if it doesn't exist. Otherwise, update the existing value with the provided.

func (*MapDBClusterStorage) Close

func (cs *MapDBClusterStorage) Close() error

Closes the backing storage

func (*MapDBClusterStorage) Each

func (cs *MapDBClusterStorage) Each(handler func(string, []byte) error) error

Iterates through all key/values for the storage and calls the handler func. If a handler returns an error, the iteration stops.

func (*MapDBClusterStorage) Remove

func (cs *MapDBClusterStorage) Remove(key string) error

Removes a key from the cluster storage

Jump to

Keyboard shortcuts

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