Skip to content

Commit

Permalink
fix(cdsctl): display list-encrypted-data (#5215)
Browse files Browse the repository at this point in the history
  • Loading branch information
yesnault authored May 28, 2020
1 parent 132c980 commit 486820a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cli/cdsctl/admin_database.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"fmt"

"github.com/spf13/cobra"

"github.com/ovh/cds/cli"
Expand All @@ -18,7 +20,7 @@ func adminDatabase() *cobra.Command {
cli.NewListCommand(adminDatabaseMigrationsList, adminDatabaseMigrationsListFunc, nil),
cli.NewGetCommand(adminDatabaseSignatureResume, adminDatabaseSignatureResumeFunc, nil),
cli.NewCommand(adminDatabaseSignatureRoll, adminDatabaseSignatureRollFunc, nil),
cli.NewGetCommand(adminDatabaseEncryptionResume, adminDatabaseEncryptionResumeFunc, nil),
cli.NewCommand(adminDatabaseEncryptionResume, adminDatabaseEncryptionResumeFunc, nil),
cli.NewCommand(adminDatabaseEncryptionRoll, adminDatabaseEncryptionRollFunc, nil),
})
}
Expand Down Expand Up @@ -78,7 +80,6 @@ var adminDatabaseSignatureRoll = cli.Command{
}

func adminDatabaseSignatureRollFunc(args cli.Values) error {

entities := args.GetStringSlice("entity")
if len(entities) == 0 {
return client.AdminDatabaseSignaturesRollAllEntities()
Expand All @@ -91,16 +92,19 @@ func adminDatabaseSignatureRollFunc(args cli.Values) error {
}

return nil

}

var adminDatabaseEncryptionResume = cli.Command{
Name: "list-encrypted-data",
Short: "List all encrypted data in database",
}

func adminDatabaseEncryptionResumeFunc(_ cli.Values) (interface{}, error) {
return client.AdminDatabaseListEncryptedEntities()
func adminDatabaseEncryptionResumeFunc(_ cli.Values) error {
entities, err := client.AdminDatabaseListEncryptedEntities()
for _, e := range entities {
fmt.Println(e)
}
return err
}

var adminDatabaseEncryptionRoll = cli.Command{
Expand All @@ -122,7 +126,5 @@ func adminDatabaseEncryptionRollFunc(args cli.Values) error {
return err
}
}

return nil

}

0 comments on commit 486820a

Please sign in to comment.