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:
Dana Axinte
2025-06-30 17:17:07 +01:00
committed by GitHub
co-authored by Michael Mandrus Matheus Macabu
parent 2d634639a2
commit 0fccc01ebe
39 changed files with 1097 additions and 25 deletions
@@ -0,0 +1,19 @@
INSERT INTO {{ .Ident "secret_data_key" }} (
{{ .Ident "uid" }},
{{ .Ident "namespace" }},
{{ .Ident "label" }},
{{ .Ident "provider" }},
{{ .Ident "encrypted_data" }},
{{ .Ident "active" }},
{{ .Ident "created" }},
{{ .Ident "updated" }}
) VALUES (
{{ .Arg .Row.UID }},
{{ .Arg .Row.Namespace }},
{{ .Arg .Row.Label }},
{{ .Arg .Row.Provider }},
{{ .Arg .Row.EncryptedData }},
{{ .Arg .Row.Active }},
{{ .Arg .Row.Created }},
{{ .Arg .Row.Updated }}
);
@@ -0,0 +1,4 @@
DELETE FROM {{ .Ident "secret_data_key" }}
WHERE {{ .Ident "namespace" }} = {{ .Arg .Namespace }} AND
{{ .Ident "uid" }} = {{ .Arg .UID }}
;
@@ -0,0 +1,8 @@
UPDATE
{{ .Ident "secret_data_key" }}
SET
{{ .Ident "active" }} = false,
{{ .Ident "updated" }} = {{ .Arg .Updated }}
WHERE {{ .Ident "namespace" }} = {{ .Arg .Namespace }} AND
{{ .Ident "active" }} = true
;
@@ -0,0 +1,13 @@
SELECT
{{ .Ident "uid" }},
{{ .Ident "namespace" }},
{{ .Ident "label" }},
{{ .Ident "provider" }},
{{ .Ident "encrypted_data" }},
{{ .Ident "active" }},
{{ .Ident "created" }},
{{ .Ident "updated" }}
FROM
{{ .Ident "secret_data_key" }}
WHERE {{ .Ident "namespace" }} = {{ .Arg .Namespace }}
;
@@ -0,0 +1,14 @@
SELECT
{{ .Ident "uid" }},
{{ .Ident "namespace" }},
{{ .Ident "label" }},
{{ .Ident "provider" }},
{{ .Ident "encrypted_data" }},
{{ .Ident "active" }},
{{ .Ident "created" }},
{{ .Ident "updated" }}
FROM
{{ .Ident "secret_data_key" }}
WHERE {{ .Ident "namespace" }} = {{ .Arg .Namespace }} AND
{{ .Ident "uid" }} = {{ .Arg .UID }}
;
@@ -0,0 +1,15 @@
SELECT
{{ .Ident "uid" }},
{{ .Ident "namespace" }},
{{ .Ident "label" }},
{{ .Ident "provider" }},
{{ .Ident "encrypted_data" }},
{{ .Ident "active" }},
{{ .Ident "created" }},
{{ .Ident "updated" }}
FROM
{{ .Ident "secret_data_key" }}
WHERE {{ .Ident "namespace" }} = {{ .Arg .Namespace }} AND
{{ .Ident "label" }} = {{ .Arg .Label }} AND
{{ .Ident "active" }} = true
;