mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-12 13:43:10 +01:00
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com> Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com> Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package specs
|
|
|
|
import (
|
|
barmanapi "github.com/cloudnative-pg/barman-cloud/pkg/api"
|
|
machineryapi "github.com/cloudnative-pg/machinery/pkg/api"
|
|
)
|
|
|
|
// CollectSecretNamesFromCredentials collects the names of the secrets
|
|
func CollectSecretNamesFromCredentials(barmanCredentials *barmanapi.BarmanCredentials) []string {
|
|
var references []*machineryapi.SecretKeySelector
|
|
if barmanCredentials.AWS != nil {
|
|
references = append(
|
|
references,
|
|
barmanCredentials.AWS.AccessKeyIDReference,
|
|
barmanCredentials.AWS.SecretAccessKeyReference,
|
|
barmanCredentials.AWS.RegionReference,
|
|
barmanCredentials.AWS.SessionToken,
|
|
)
|
|
}
|
|
if barmanCredentials.Azure != nil {
|
|
references = append(
|
|
references,
|
|
barmanCredentials.Azure.ConnectionString,
|
|
barmanCredentials.Azure.StorageAccount,
|
|
barmanCredentials.Azure.StorageKey,
|
|
barmanCredentials.Azure.StorageSasToken,
|
|
)
|
|
}
|
|
if barmanCredentials.Google != nil {
|
|
references = append(
|
|
references,
|
|
barmanCredentials.Google.ApplicationCredentials,
|
|
)
|
|
}
|
|
|
|
result := make([]string, 0, len(references))
|
|
for _, reference := range references {
|
|
if reference == nil {
|
|
continue
|
|
}
|
|
result = append(result, reference.Name)
|
|
}
|
|
|
|
// TODO: stringset belongs to machinery :(
|
|
|
|
return result
|
|
}
|