2022-02-23 09:04:53 -06:00
|
|
|
package secretsmigrations
|
|
|
|
|
|
|
|
import (
|
2022-07-04 05:17:21 -05:00
|
|
|
"context"
|
2022-02-23 09:04:53 -06:00
|
|
|
|
2022-07-04 05:17:21 -05:00
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
2023-03-17 10:36:39 -05:00
|
|
|
"github.com/grafana/grafana/pkg/server"
|
2022-02-23 09:04:53 -06:00
|
|
|
)
|
|
|
|
|
2023-03-17 10:36:39 -05:00
|
|
|
func ReEncryptDEKS(_ utils.CommandLine, runner server.Runner) error {
|
2022-07-04 05:17:21 -05:00
|
|
|
return runner.SecretsService.ReEncryptDataKeys(context.Background())
|
2022-02-23 09:04:53 -06:00
|
|
|
}
|
|
|
|
|
2023-03-17 10:36:39 -05:00
|
|
|
func ReEncryptSecrets(_ utils.CommandLine, runner server.Runner) error {
|
2022-07-18 01:57:58 -05:00
|
|
|
_, err := runner.SecretsMigrator.ReEncryptSecrets(context.Background())
|
|
|
|
return err
|
2022-02-23 09:04:53 -06:00
|
|
|
}
|
|
|
|
|
2023-03-17 10:36:39 -05:00
|
|
|
func RollBackSecrets(_ utils.CommandLine, runner server.Runner) error {
|
2022-07-18 01:57:58 -05:00
|
|
|
_, err := runner.SecretsMigrator.RollBackSecrets(context.Background())
|
|
|
|
return err
|
2022-07-04 05:17:21 -05:00
|
|
|
}
|