MCPcopy
hub / github.com/cloudflare/cloudflared / buildTokenSubcommand

Function buildTokenSubcommand

cmd/cloudflared/management/cmd.go:37–66  ·  view source on GitHub ↗

buildTokenSubcommand creates the token subcommand

()

Source from the content-addressed store, hash-verified

35
36// buildTokenSubcommand creates the token subcommand
37func buildTokenSubcommand() *cli.Command {
38 return &cli.Command{
39 Name: "token",
40 Action: cliutil.ConfiguredAction(tokenCommand),
41 Usage: "Get management access jwt for a specific resource",
42 UsageText: "cloudflared management token --resource <resource> TUNNEL_ID",
43 Description: "Get management access jwt for a tunnel with specified resource permissions (logs, admin, host_details)",
44 Hidden: true,
45 Flags: []cli.Flag{
46 &cli.StringFlag{
47 Name: "resource",
48 Usage: "Resource type for token permissions: logs, admin, or host_details",
49 Required: true,
50 },
51 &cli.StringFlag{
52 Name: cfdflags.OriginCert,
53 Usage: "Path to the certificate generated for your origin when you run cloudflared login.",
54 EnvVars: []string{"TUNNEL_ORIGIN_CERT"},
55 Value: credentials.FindDefaultOriginCertPath(),
56 },
57 &cli.StringFlag{
58 Name: cfdflags.LogLevel,
59 Value: "info",
60 Usage: "Application logging level {debug, info, warn, error, fatal}",
61 EnvVars: []string{"TUNNEL_LOGLEVEL"},
62 },
63 cliutil.FlagLogOutput,
64 },
65 }
66}
67
68// tokenCommand handles the token subcommand execution
69func tokenCommand(c *cli.Context) error {

Callers 1

CommandFunction · 0.85

Calls 2

ConfiguredActionFunction · 0.92

Tested by

no test coverage detected