MCPcopy Create free account
hub / github.com/rilldata/rill / ManagerTokenCmd

Function ManagerTokenCmd

cli/cmd/sudo/runtime/manager_token.go:9–35  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

7)
8
9func ManagerTokenCmd(ch *cmdutil.Helper) *cobra.Command {
10 cmd := &cobra.Command{
11 Use: "manager-token <host>",
12 Args: cobra.ExactArgs(1),
13 Short: "Returns a token with full manager permissions for a runtime",
14 RunE: func(cmd *cobra.Command, args []string) error {
15 ctx := cmd.Context()
16
17 client, err := ch.Client()
18 if err != nil {
19 return err
20 }
21
22 res, err := client.SudoIssueRuntimeManagerToken(ctx, &adminv1.SudoIssueRuntimeManagerTokenRequest{
23 Host: args[0],
24 })
25 if err != nil {
26 return err
27 }
28
29 ch.Printf("%s\n", res.Token)
30 return nil
31 },
32 }
33
34 return cmd
35}

Callers 1

RuntimeCmdFunction · 0.85

Calls 4

PrintfMethod · 0.80
ContextMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected