common

package
v2.3.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalHelpString = "CLI Admin tool for the Teleport Auth service. Runs on a host where Teleport Auth is running."
	AddUserHelp      = `` /* 621-byte string literal not displayed */

	AddNodeHelp = `` /* 501-byte string literal not displayed */

	ListNodesHelp = `Notes:
  SSH nodes send periodic heartbeat to the Auth service. This command prints
  the list of current online nodes.
`
)

Variables

This section is empty.

Functions

func Run

func Run(distro teleport.DistroType, commands []CLICommand)

Run() is the same as 'make'. It helps to share the code between different "distributions" like OSS or Enterprise

distribution: name of the Teleport distribution

func UpsertVerb

func UpsertVerb(exists bool) string

Types

type AuthCommand

type AuthCommand struct {
	// contains filtered or unexported fields
}

AuthCommand implements `tctl auth` group of commands

func (*AuthCommand) ExportAuthorities

func (a *AuthCommand) ExportAuthorities(client *auth.TunClient) error

ExportAuthorities outputs the list of authorities in OpenSSH compatible formats If --type flag is given, only prints keys for CAs of this type, otherwise prints all keys

func (*AuthCommand) GenerateAndSignKeys

func (a *AuthCommand) GenerateAndSignKeys(clusterApi *auth.TunClient) error

GenerateAndSignKeys generates a new keypair and signs it for role

func (*AuthCommand) GenerateKeys

func (a *AuthCommand) GenerateKeys() error

GenerateKeys generates a new keypair

func (*AuthCommand) Initialize

func (a *AuthCommand) Initialize(app *kingpin.Application, config *service.Config)

Initialize allows TokenCommand to plug itself into the CLI parser

func (*AuthCommand) TryRun

func (a *AuthCommand) TryRun(cmd string, client *auth.TunClient) (match bool, err error)

TryRun takes the CLI command as an argument (like "auth gen") and executes it or returns match=false if 'cmd' does not belong to it

type CLICommand

type CLICommand interface {
	// Initialize allows a caller-defined command to plug itself into CLI
	// argument parsing
	Initialize(*kingpin.Application, *service.Config)

	// TryRun is executed after the CLI parsing is done. The command must
	// determine if selectedCommand belongs to it and return match=true
	TryRun(selectedCommand string, c *auth.TunClient) (match bool, err error)
}

CLICommand interface must be implemented by every CLI command

This allows OSS and Enterprise Teleport editions to plug their own implementations of different CLI commands into the common execution framework

type GlobalCLIFlags

type GlobalCLIFlags struct {
	Debug        bool
	ConfigFile   string
	ConfigString string
}

GlobalCLIFlags keeps the CLI flags that apply to all tctl commands

type NodeCommand

type NodeCommand struct {
	// contains filtered or unexported fields
}

NodeCommand implements `tctl nodes` group of commands

func (*NodeCommand) Initialize

func (c *NodeCommand) Initialize(app *kingpin.Application, config *service.Config)

Initialize allows NodeCommand to plug itself into the CLI parser

func (*NodeCommand) Invite

func (c *NodeCommand) Invite(client *auth.TunClient) error

Invite generates a token which can be used to add another SSH node to a cluster

func (*NodeCommand) ListActive

func (c *NodeCommand) ListActive(client *auth.TunClient) error

ListActive retreives the list of nodes who recently sent heartbeats to to a cluster and prints it to stdout

func (*NodeCommand) TryRun

func (c *NodeCommand) TryRun(cmd string, client *auth.TunClient) (match bool, err error)

TryRun takes the CLI command as an argument (like "nodes ls") and executes it.

type ResourceCollection

type ResourceCollection interface {
	// contains filtered or unexported methods
}

type ResourceCommand

type ResourceCommand struct {
	CreateHandlers map[ResourceKind]ResourceCreateHandler
	// contains filtered or unexported fields
}

ResourceCommand implements `tctl get/create/list` commands for manipulating Teleport resources

func (*ResourceCommand) Create

func (u *ResourceCommand) Create(client *auth.TunClient) error

Create updates or insterts one or many resources

func (*ResourceCommand) Delete

func (d *ResourceCommand) Delete(client *auth.TunClient) (err error)

Delete deletes resource by name

func (*ResourceCommand) Get

func (g *ResourceCommand) Get(client *auth.TunClient) error

Get prints one or many resources of a certain type

func (*ResourceCommand) GetRef

func (g *ResourceCommand) GetRef() services.Ref

GetRef returns the reference (basically type/name pair) of the resource the command is operating on

func (*ResourceCommand) Initialize

func (g *ResourceCommand) Initialize(app *kingpin.Application, config *service.Config)

Initialize allows ResourceCommand to plug itself into the CLI parser

func (*ResourceCommand) IsDeleteSubcommand

func (g *ResourceCommand) IsDeleteSubcommand(cmd string) bool

IsDeleteSubcommand returns 'true' if the given command is `tctl rm`

func (*ResourceCommand) IsForced

func (cmd *ResourceCommand) IsForced() bool

IsForced returns true if -f flag was passed

func (*ResourceCommand) TryRun

func (g *ResourceCommand) TryRun(cmd string, client *auth.TunClient) (match bool, err error)

TryRun takes the CLI command as an argument (like "auth gen") and executes it or returns match=false if 'cmd' does not belong to it

type ResourceCreateHandler

type ResourceCreateHandler func(*auth.TunClient, services.UnknownResource) error

type ResourceKind

type ResourceKind string

type TokenCommand

type TokenCommand struct {
	// contains filtered or unexported fields
}

TokenCommand implements `tctl token` group of commands

func (*TokenCommand) Del

func (c *TokenCommand) Del(client *auth.TunClient) error

onTokenList is called to execute "tokens del" command

func (*TokenCommand) Initialize

func (c *TokenCommand) Initialize(app *kingpin.Application, config *service.Config)

Initialize allows TokenCommand to plug itself into the CLI parser

func (*TokenCommand) List

func (c *TokenCommand) List(client *auth.TunClient) error

onTokenList is called to execute "tokens ls" command

func (*TokenCommand) TryRun

func (c *TokenCommand) TryRun(cmd string, client *auth.TunClient) (match bool, err error)

TryRun takes the CLI command as an argument (like "nodes ls") and executes it.

type UserCommand

type UserCommand struct {
	// contains filtered or unexported fields
}

UserCommand implements `tctl users` set of commands It implements CLICommand interface

func (*UserCommand) Add

func (u *UserCommand) Add(client *auth.TunClient) error

Add creates a new sign-up token and prints a token URL to stdout. A user is not created until he visits the sign-up URL and completes the process

func (*UserCommand) Delete

func (u *UserCommand) Delete(client *auth.TunClient) error

Delete deletes teleport user(s). User IDs are passed as a comma-separated list in UserCommand.login

func (*UserCommand) Initialize

func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config)

Initialize allows UserCommand to plug itself into the CLI parser

func (*UserCommand) List

func (u *UserCommand) List(client *auth.TunClient) error

List prints all existing user accounts

func (*UserCommand) PrintSignupURL

func (u *UserCommand) PrintSignupURL(client *auth.TunClient, token string)

func (*UserCommand) TryRun

func (u *UserCommand) TryRun(cmd string, client *auth.TunClient) (match bool, err error)

TryRun takes the CLI command as an argument (like "users add") and executes it.

func (*UserCommand) Update

func (u *UserCommand) Update(client *auth.TunClient) error

Update updates existing user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL