mirror of
https://github.com/grafana/grafana.git
synced 2025-09-29 04:24:00 +08:00

Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com> Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
39 lines
1.6 KiB
Go
39 lines
1.6 KiB
Go
package contracts
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
secretv0alpha1 "github.com/grafana/grafana/pkg/apis/secret/v0alpha1"
|
|
"github.com/grafana/grafana/pkg/registry/apis/secret/xkube"
|
|
)
|
|
|
|
type DecryptSecureValue struct {
|
|
Keeper *string
|
|
Ref string
|
|
ExternalID string
|
|
Decrypters []string
|
|
}
|
|
|
|
var (
|
|
ErrSecureValueNotFound = errors.New("secure value not found")
|
|
ErrSecureValueAlreadyExists = errors.New("secure value already exists")
|
|
ErrSecureValueOperationInProgress = errors.New("an operation is already in progress for the secure value")
|
|
)
|
|
|
|
type ReadOpts struct {
|
|
ForUpdate bool
|
|
}
|
|
|
|
// SecureValueMetadataStorage is the interface for wiring and dependency injection.
|
|
type SecureValueMetadataStorage interface {
|
|
Create(ctx context.Context, sv *secretv0alpha1.SecureValue, actorUID string) (*secretv0alpha1.SecureValue, error)
|
|
Read(ctx context.Context, namespace xkube.Namespace, name string, opts ReadOpts) (*secretv0alpha1.SecureValue, error)
|
|
Update(ctx context.Context, sv *secretv0alpha1.SecureValue, actorUID string) (*secretv0alpha1.SecureValue, error)
|
|
Delete(ctx context.Context, namespace xkube.Namespace, name string) error
|
|
List(ctx context.Context, namespace xkube.Namespace) (*secretv0alpha1.SecureValueList, error)
|
|
SetStatus(ctx context.Context, namespace xkube.Namespace, name string, status secretv0alpha1.SecureValueStatus) error
|
|
SetExternalID(ctx context.Context, namespace xkube.Namespace, name string, externalID ExternalID) error
|
|
ReadForDecrypt(ctx context.Context, namespace xkube.Namespace, name string) (*DecryptSecureValue, error)
|
|
}
|