Skip to content

Commit

Permalink
tapcli: add universe deletion support
Browse files Browse the repository at this point in the history
  • Loading branch information
jharveyb committed Jun 1, 2023
1 parent 46c71f3 commit 53f326a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cmd/tapcli/universe.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var universeCommands = []cli.Command{
Category: "Universe",
Subcommands: []cli.Command{
universeRootsCommand,
universeDeleteRootCommand,
universeLeavesCommand,
universeKeysCommand,
universeProofCommand,
Expand Down Expand Up @@ -143,6 +144,46 @@ func universeRoots(ctx *cli.Context) error {
return nil
}

var universeDeleteRootCommand = cli.Command{
Name: "delete",
ShortName: "d",
Description: "Delete a known asset universe root",
Usage: "list the known asset universe root",
Flags: []cli.Flag{
cli.StringFlag{
Name: assetIDName,
Usage: "the asset ID of the universe to delete",
},
cli.StringFlag{
Name: groupKeyName,
Usage: "the group key of the universe to delete",
},
},
Action: deleteUniverseRoot,
}

func deleteUniverseRoot(ctx *cli.Context) error {
ctxc := getContext()
client, cleanUp := getUniverseClient(ctx)
defer cleanUp()

universeID, err := parseUniverseID(ctx, true)
if err != nil {
return err
}

rootReq := &universerpc.AssetRootQuery{
Id: universeID,
}

_, err = client.DeleteAssetRoot(ctxc, rootReq)
if err != nil {
return err
}

return nil
}

var universeKeysCommand = cli.Command{
Name: "keys",
ShortName: "k",
Expand Down

0 comments on commit 53f326a

Please sign in to comment.