Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend[T Object] interface { // Get retrieves the value associated with the given key. Get(ctx context.Context, key string) (T, error) // Set stores the value associated with the given key. // The Object should have the method [Object.Validate] called before this. Set(ctx context.Context, key string, value T) error // Delete removes the value associated with the given key. Delete(ctx context.Context, key string) error // List returns a list of all keys in the storage. List(ctx context.Context) (map[string]T, error) }
Backend is the interface for a storage backend. A storage backend is responsible for storing and retrieving configurations or data defined by the user.
type ConfigMap ¶
type ConfigMap[T Object] struct { // contains filtered or unexported fields }
ConfigMap is a Backend that uses a Kubernetes config map to store and retrieve objects.
func NewConfigMap ¶
func NewConfigMap[T Object]( name string, cm typedCorev1.ConfigMapInterface, ) *ConfigMap[T]
type Object ¶
type Object interface {
// Validate validates the object. It will be given a [cluster.Context]
// for the current users context and can reach out to the cluster API
// to validate the object. If the object is not valid, it should return
// a non-nil error.
Validate(ctx context.Context, clusterCtx cluster.Context) error
}
Object is an interface that represents a generic object that defines user data. It is the value that will be associated with a key and stored by a Backend. The object will be marshalled and unmarshalled using functions from the yaml library, unless it implements the encoding.TextMarshaler or encoding.TextUnmarshaler interfaces in which case those will be used instead.
type SecretStore ¶
type SecretStore[T Object] struct { // contains filtered or unexported fields }
SecretStore is a Backend that uses a Kubernetes secret to store and retrieve objects.
func NewSecretStore ¶
func NewSecretStore[T Object]( name string, s typedCorev1.SecretInterface, ) *SecretStore[T]
NewSecretStore creates a new SecretStore with the given name and defaults.
func (*SecretStore[T]) Delete ¶
func (c *SecretStore[T]) Delete(ctx context.Context, key string) error
func (*SecretStore[T]) Get ¶
func (c *SecretStore[T]) Get(ctx context.Context, key string) (T, error)