teleport

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 18 Imported by: 0

README

POSH teleport provider

Usage

Plugin
package main

type Plugin struct {
  l        log.Logger
  cache    cache.Cache
  kubectl  *kubectl.Kubectl
  teleport *teleport.Teleport
  commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  inst := &Plugin{
    l:        l,
    cache:    &cache.MemoryCache{},
    commands: command.Commands{},
  }

  // ...

  if value, err := kubectl.New(l, inst.cache); err != nil {
    return nil, err
  } else {
    inst.kubectl = value
  }

  if value, err := teleport.NewTeleport(l, inst.cache); err != nil {
    return nil, err
  } else {
    inst.teleport = value
  }

  // ...

  inst.commands.Add(teleport.NewCommand(l, inst.cache, inst.teleport, inst.kubectl))

  // ...

  return inst, nil
}
Config
## Teleport
teleport:
  path: ".posh/config/teleport"
  hostname: teleport.foo.bar:443
  labels:
    project: "foo"
  database:
    user: developers
  kubernetes:
    aliases:
      kubernetes-dev: dev
      kubernetes-prod: prod

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthChecker

func AuthChecker(p *Teleport) check.Checker

Types

type Command

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

func NewCommand

func NewCommand(l log.Logger, cache cache.Cache, teleport *Teleport, kubectl *kubectl.Kubectl, opts ...CommandOption) *Command

func (*Command) Complete

func (c *Command) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest

func (*Command) Description

func (c *Command) Description() string

func (*Command) Execute

func (c *Command) Execute(ctx context.Context, r *readline.Readline) error

func (*Command) Help

func (c *Command) Help(ctx context.Context, r *readline.Readline) string

func (*Command) Name

func (c *Command) Name() string

type CommandOption

type CommandOption func(*Command)

func CommandWithName

func CommandWithName(v string) CommandOption

type Config

type Config struct {
	Path       string              `json:"path" yaml:"path"`
	Labels     map[string]string   `json:"labels" yaml:"labels"`
	Hostname   string              `json:"hostname" yaml:"hostname"`
	Kubernetes Kubernetes          `json:"kubernetes" yaml:"kubernetes"`
	Apps       map[string][]string `json:"apps" yaml:"apps"`
	Database   Database            `json:"database" yaml:"database"`
}

func (Config) Query

func (c Config) Query() string

type Database

type Database struct {
	User string `json:"user" yaml:"user"`
}

func (Database) EnvUser

func (c Database) EnvUser() string

type Kubernetes

type Kubernetes struct {
	Aliases map[string]string `json:"aliases" yaml:"aliases"`
}

func (Kubernetes) Alias

func (c Kubernetes) Alias(name string) string

func (Kubernetes) Name

func (c Kubernetes) Name(alias string) string

type Option

type Option func(*Teleport) error

Teleport command

func CommandWithConfigKey

func CommandWithConfigKey(v string) Option

type Teleport

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

Teleport command

func NewTeleport

func NewTeleport(l log.Logger, cache cache.Cache, opts ...Option) (*Teleport, error)

NewTeleport command

func (*Teleport) Apps added in v0.11.0

func (t *Teleport) Apps(ctx context.Context) []string

Apps returns a list of cluster

func (*Teleport) Clusters

func (t *Teleport) Clusters(ctx context.Context) []string

Clusters returns a list of cluster

func (*Teleport) Config

func (t *Teleport) Config() Config

func (*Teleport) Databases

func (t *Teleport) Databases(ctx context.Context) []string

Databases returns a list of cluster

func (*Teleport) IsAuthenticated

func (t *Teleport) IsAuthenticated(ctx context.Context) bool

Jump to

Keyboard shortcuts

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