Skip to content

Commit c32bb17

Browse files
authored
Adding admin command for retrieving cluster metadata (#865)
1 parent 27965f4 commit c32bb17

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tools/cli/admin.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,14 @@ func newAdminClusterCommands() []cli.Command {
755755
AdminDescribeCluster(c)
756756
},
757757
},
758+
{
759+
Name: "metadata",
760+
Aliases: []string{"m"},
761+
Usage: "Show cluster metadata",
762+
Action: func(c *cli.Context) {
763+
AdminClusterMetadata(c)
764+
},
765+
},
758766
}
759767
}
760768

tools/cli/adminClusterCommands.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/fatih/color"
3131
"github.com/urfave/cli"
3232
enumspb "go.temporal.io/api/enums/v1"
33+
"go.temporal.io/api/workflowservice/v1"
3334

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

8384
prettyPrintJSONObject(response)
8485
}
86+
87+
// AdminDescribeCluster is used to dump information about the cluster
88+
func AdminClusterMetadata(c *cli.Context) {
89+
frontendClient := cFactory.FrontendClient(c)
90+
ctx, cancel := newContext(c)
91+
defer cancel()
92+
93+
info, err := frontendClient.GetClusterInfo(ctx, &workflowservice.GetClusterInfoRequest{})
94+
if err != nil {
95+
ErrorAndExit("Operation AdminClusterMetadata failed.", err)
96+
}
97+
prettyPrintJSONObject(info)
98+
}

0 commit comments

Comments
 (0)