embeddedtbot

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotConfig

type BotConfig config.BotConfig

BotConfig contains the embedded tbot configuration. This is a wrapper around the pure tbot config.BotConfig structure and exposes utils to parse configuration from CLI flags and operator-specific defaults.

func (*BotConfig) BindFlags

func (c *BotConfig) BindFlags(fs *flag.FlagSet)

BindFlags binds BotConfig fields to CLI flags. When calling flag.Parse(), the bot configuration will be parsed and the structure populated.

type EmbeddedBot

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

EmbeddedBot is an embedded tBot instance to renew the operator certificates.

func New

func New(botConfig *BotConfig) (*EmbeddedBot, error)

New creates a new EmbeddedBot from a BotConfig.

func (*EmbeddedBot) Preflight

func (b *EmbeddedBot) Preflight(ctx context.Context) (*proto.PingResponse, error)

Preflight has two responsibilities: - connect to Teleport using tbot, get a certificate, validate that everything is set up properly (roles, bot, token, ...) - return the server features It allows us to fail fast and validate if something is broken before starting the manager.

func (*EmbeddedBot) Start

func (b *EmbeddedBot) Start(ctx context.Context) error

Start is a lie, the bot is already started. DO NOT CALL Start if you want to run the bot, call StartAndWaitForClient. We mimick a legitimate Start() behavior by returning if the bot exists and propagating context cancellation.

func (*EmbeddedBot) StartAndWaitForClient

func (b *EmbeddedBot) StartAndWaitForClient(ctx context.Context, deadline time.Duration) (*client.Client, error)

StartAndWaitForClient starts the EmbeddedBot and waits for a client to be available. This is the proper way of starting the EmbeddedBot. It returns an error if the EmbeddedBot is not able to get a certificate before the deadline.

type StringListVar

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

StringListVar is used to parse comma-separated strings with the flag library. The structure implements the flag.Value interface.

func (*StringListVar) Set

func (f *StringListVar) Set(arg string) error

Set implements the flag.Value interface. It splits a single comma-separated string into a string slice.

func (*StringListVar) String

func (f *StringListVar) String() string

String implements the flag.Value interface. It joins all list items in a single comma-separated string.

Jump to

Keyboard shortcuts

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