Skip to content

Commit

Permalink
Adding admin command for retrieving cluster metadata (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitarb committed Oct 15, 2020
1 parent 27965f4 commit c32bb17
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/cli/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,14 @@ func newAdminClusterCommands() []cli.Command {
AdminDescribeCluster(c)
},
},
{
Name: "metadata",
Aliases: []string{"m"},
Usage: "Show cluster metadata",
Action: func(c *cli.Context) {
AdminClusterMetadata(c)
},
},
}
}

Expand Down
14 changes: 14 additions & 0 deletions tools/cli/adminClusterCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/fatih/color"
"github.com/urfave/cli"
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/workflowservice/v1"

"go.temporal.io/server/api/adminservice/v1"
)
Expand Down Expand Up @@ -82,3 +83,16 @@ func AdminDescribeCluster(c *cli.Context) {

prettyPrintJSONObject(response)
}

// AdminDescribeCluster is used to dump information about the cluster
func AdminClusterMetadata(c *cli.Context) {
frontendClient := cFactory.FrontendClient(c)
ctx, cancel := newContext(c)
defer cancel()

info, err := frontendClient.GetClusterInfo(ctx, &workflowservice.GetClusterInfoRequest{})
if err != nil {
ErrorAndExit("Operation AdminClusterMetadata failed.", err)
}
prettyPrintJSONObject(info)
}

0 comments on commit c32bb17

Please sign in to comment.