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
@@ -4,7 +4,9 @@ import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/registry/apis/secret/contracts"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate"
|
||||
)
|
||||
|
||||
@@ -19,6 +21,13 @@ var (
|
||||
sqlEncryptedValueRead = mustTemplate("encrypted_value_read.sql")
|
||||
sqlEncryptedValueUpdate = mustTemplate("encrypted_value_update.sql")
|
||||
sqlEncryptedValueDelete = mustTemplate("encrypted_value_delete.sql")
|
||||
|
||||
sqlDataKeyCreate = mustTemplate("data_key_create.sql")
|
||||
sqlDataKeyRead = mustTemplate("data_key_read.sql")
|
||||
sqlDataKeyReadCurrent = mustTemplate("data_key_read_current.sql")
|
||||
sqlDataKeyList = mustTemplate("data_key_list.sql")
|
||||
sqlDataKeyDisable = mustTemplate("data_key_disable.sql")
|
||||
sqlDataKeyDelete = mustTemplate("data_key_delete.sql")
|
||||
)
|
||||
|
||||
// TODO: Move this to a common place so that all stores can use
|
||||
@@ -79,3 +88,52 @@ type deleteEncryptedValue struct {
|
||||
func (r deleteEncryptedValue) Validate() error {
|
||||
return nil // TODO
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/**-- Data Key Queries --**/
|
||||
/*************************************/
|
||||
type createDataKey struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Row *contracts.SecretDataKey
|
||||
}
|
||||
|
||||
func (r createDataKey) Validate() error { return nil }
|
||||
|
||||
type readDataKey struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Namespace string
|
||||
UID string
|
||||
}
|
||||
|
||||
func (r readDataKey) Validate() error { return nil }
|
||||
|
||||
type readCurrentDataKey struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Namespace string
|
||||
Label string
|
||||
}
|
||||
|
||||
func (r readCurrentDataKey) Validate() error { return nil }
|
||||
|
||||
type listDataKeys struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Namespace string
|
||||
}
|
||||
|
||||
func (r listDataKeys) Validate() error { return nil }
|
||||
|
||||
type disableDataKeys struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Namespace string
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
func (r disableDataKeys) Validate() error { return nil }
|
||||
|
||||
type deleteDataKey struct {
|
||||
sqltemplate.SQLTemplate
|
||||
Namespace string
|
||||
UID string
|
||||
}
|
||||
|
||||
func (r deleteDataKey) Validate() error { return nil }
|
||||
|
||||
Reference in New Issue
Block a user