zitadel/cmd/zitadelctl/cmds/backuplist.go
Elio Bischof fbe0f311f2
feat: comprehensive sentry instrumentation (#2023)
* feat: comprehensive sentry instrumentation

* test: pass

* fix: only fetch zitadel dsn in zitadel-operator

* chore: use dns for sentry environment as soon as parsed

* fix: trust ca certs

* ci: update orbos

* docs: add usage data explanation

* fix: dont send validation errors

* docs: improve ingestion data explanation

* style: rename flag --disable-ingestion to --disable-analytics

* fix: pass --disable-analytics flag to self deployments

* fix: destroy command for sentry

* fix: update orbos

* fix: only switch environment if analytics is enabled

* fix: ensure SENTRY_DSN is always set

* test: test empty sentry dsn

* ci: invalidate build caches

* chore: use zitadel-dev if no version is passed

* chore: combine dev releases in sentry

* refactor: only check for semrel if sentry is enabled
2021-07-30 09:52:08 +00:00

63 lines
1.2 KiB
Go

package cmds
import (
"fmt"
"sort"
"github.com/spf13/cobra"
"github.com/caos/orbos/pkg/kubernetes/cli"
"github.com/caos/zitadel/pkg/databases"
)
func BackupListCommand(getRv GetRootValues) *cobra.Command {
var (
cmd = &cobra.Command{
Use: "backuplist",
Short: "Get a list of all backups",
Long: "Get a list of all backups",
}
)
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
rv := getRv("backuplist", nil, "")
defer func() {
err = rv.ErrFunc(err)
}()
monitor := rv.Monitor
orbConfig := rv.OrbConfig
gitClient := rv.GitClient
backups := make([]string, 0)
k8sClient, err := cli.Client(monitor, orbConfig, rv.GitClient, rv.Kubeconfig, rv.Gitops, true)
if err != nil {
return err
}
if rv.Gitops {
backupsT, err := databases.GitOpsListBackups(monitor, gitClient, k8sClient)
if err != nil {
return err
}
backups = backupsT
} else {
backupsT, err := databases.CrdListBackups(monitor, k8sClient)
if err != nil {
return err
}
backups = backupsT
}
sort.Slice(backups, func(i, j int) bool {
return backups[i] > backups[j]
})
for _, backup := range backups {
fmt.Println(backup)
}
return nil
}
return cmd
}