SecretsManager: add data key store (#107396)
* SecretsManager: Add data key store Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com> Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com> * SecretsManager: Add wiring of data key store Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com> Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com> --------- Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com> Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
This commit is contained in:
co-authored by
Michael Mandrus
Matheus Macabu
parent
2d634639a2
commit
0fccc01ebe
@@ -0,0 +1,35 @@
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/registry/apis/secret/encryption"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrDataKeyNotFound = errors.New("data key not found")
|
||||
)
|
||||
|
||||
// SecretDataKey does not have a mirrored K8s resource
|
||||
type SecretDataKey struct {
|
||||
UID string
|
||||
Active bool
|
||||
Namespace string
|
||||
Label string
|
||||
Provider encryption.ProviderID
|
||||
EncryptedData []byte
|
||||
Created time.Time
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
// DataKeyStorage is the interface for wiring and dependency injection.
|
||||
type DataKeyStorage interface {
|
||||
CreateDataKey(ctx context.Context, dataKey *SecretDataKey) error
|
||||
GetDataKey(ctx context.Context, namespace, uid string) (*SecretDataKey, error)
|
||||
GetCurrentDataKey(ctx context.Context, namespace, label string) (*SecretDataKey, error)
|
||||
GetAllDataKeys(ctx context.Context, namespace string) ([]*SecretDataKey, error)
|
||||
DisableDataKeys(ctx context.Context, namespace string) error
|
||||
DeleteDataKey(ctx context.Context, namespace, uid string) error
|
||||
}
|
||||
Reference in New Issue
Block a user