Documentation ¶
Index ¶
- Constants
- type BoltDBClusterStorage
- func (cs *BoltDBClusterStorage) AddIfNotExists(key string, cluster []byte) error
- func (cs *BoltDBClusterStorage) AddOrUpdate(key string, cluster []byte) error
- func (cs *BoltDBClusterStorage) Close() error
- func (cs *BoltDBClusterStorage) Each(handler func(string, []byte) error) error
- func (cs *BoltDBClusterStorage) Remove(key string) error
- type ClusterConfigEntry
- type ClusterConfigEntryAuth
- type ClusterDefinition
- type ClusterManager
- func (cm *ClusterManager) Add(cluster ClusterDefinition) (*ClusterDefinition, error)
- func (cm *ClusterManager) AddOrUpdate(cluster ClusterDefinition) (*ClusterDefinition, error)
- func (cm *ClusterManager) Close() error
- func (cm *ClusterManager) GetAll() []*ClusterDefinition
- func (cm *ClusterManager) Remove(id string) error
- type ClusterManagerHTTPService
- func (cme *ClusterManagerHTTPService) DeleteCluster(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (cme *ClusterManagerHTTPService) GetAllClusters(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (cme *ClusterManagerHTTPService) PutCluster(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (cme *ClusterManagerHTTPService) Register(router *httprouter.Router) error
- type ClusterStorage
- type DataEnvelope
- type MapDBClusterStorage
- func (cs *MapDBClusterStorage) AddIfNotExists(key string, cluster []byte) error
- func (cs *MapDBClusterStorage) AddOrUpdate(key string, cluster []byte) error
- func (cs *MapDBClusterStorage) Close() error
- func (cs *MapDBClusterStorage) Each(handler func(string, []byte) error) error
- func (cs *MapDBClusterStorage) Remove(key string) error
Constants ¶
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
}
BoltDBClusterStorage is a boltdb implementation of a database used to store cluster definitions
func (*BoltDBClusterStorage) AddIfNotExists ¶
func (cs *BoltDBClusterStorage) AddIfNotExists(key string, cluster []byte) error
AddIfNotExists Adds the entry if the key does not exist
func (*BoltDBClusterStorage) AddOrUpdate ¶
func (cs *BoltDBClusterStorage) AddOrUpdate(key string, cluster []byte) error
AddOrUpdate 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
Close Closes the backing storage
func (*BoltDBClusterStorage) Each ¶
func (cs *BoltDBClusterStorage) Each(handler func(string, []byte) error) error
Each 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
Remove 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 ¶
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
}
ClusterManager provides an implementation
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 ¶
func (cm *ClusterManager) Add(cluster ClusterDefinition) (*ClusterDefinition, error)
Add Adds a cluster definition, but will not update an existing entry.
func (*ClusterManager) AddOrUpdate ¶
func (cm *ClusterManager) AddOrUpdate(cluster ClusterDefinition) (*ClusterDefinition, error)
AddOrUpdate will add the cluster definition if it doesn't exist, or update the existing definition if it does exist.
func (*ClusterManager) Close ¶
func (cm *ClusterManager) Close() error
Close will close the backing database
func (*ClusterManager) GetAll ¶
func (cm *ClusterManager) GetAll() []*ClusterDefinition
GetAll will return all of the cluster definitions
func (*ClusterManager) Remove ¶
func (cm *ClusterManager) Remove(id string) error
Remove will remove a cluster definition by id.
type ClusterManagerHTTPService ¶
type ClusterManagerHTTPService struct {
// contains filtered or unexported fields
}
ClusterManagerHTTPService is an implementation of HTTPService which provides the frontend with the ability to manage stored cluster definitions.
func NewClusterManagerHTTPService ¶
func NewClusterManagerHTTPService(manager *ClusterManager) *ClusterManagerHTTPService
NewClusterManagerHTTPService creates a new cluster management http service
func (*ClusterManagerHTTPService) DeleteCluster ¶
func (cme *ClusterManagerHTTPService) DeleteCluster(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*ClusterManagerHTTPService) GetAllClusters ¶
func (cme *ClusterManagerHTTPService) GetAllClusters(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*ClusterManagerHTTPService) PutCluster ¶
func (cme *ClusterManagerHTTPService) PutCluster(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*ClusterManagerHTTPService) Register ¶
func (cme *ClusterManagerHTTPService) Register(router *httprouter.Router) error
Register assigns the endpoints and returns an error on failure.
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)
NewBoltDBClusterStorage creates a new boltdb backed ClusterStorage implementation
func NewMapDBClusterStorage ¶
func NewMapDBClusterStorage() ClusterStorage
NewMapDBClusterStorage creates a new map backed ClusterStorage implementation
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
}
MapDBClusterStorage is a map implementation of a database used to store cluster definitions
func (*MapDBClusterStorage) AddIfNotExists ¶
func (cs *MapDBClusterStorage) AddIfNotExists(key string, cluster []byte) error
AddIfNotExists Adds the entry if the key does not exist
func (*MapDBClusterStorage) AddOrUpdate ¶
func (cs *MapDBClusterStorage) AddOrUpdate(key string, cluster []byte) error
AddOrUpdate 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
Close Closes the backing storage
func (*MapDBClusterStorage) Each ¶
func (cs *MapDBClusterStorage) Each(handler func(string, []byte) error) error
Each 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
Remove Removes a key from the cluster storage