clusters

package
v11.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessRequest

type AccessRequest struct {
	URI uri.ResourceURI
	types.AccessRequest
}

type App

type App struct {
	// URI is the app URI
	URI uri.ResourceURI

	types.Application
}

App describes an app

type Cluster

type Cluster struct {
	// URI is the cluster URI
	URI uri.ResourceURI
	// Name is the cluster name
	Name string
	// ProfileName is the name of the tsh profile
	ProfileName string
	// Log is a component logger
	Log *logrus.Entry

	// Auth server features
	// only present where the auth client can be queried
	// and set with GetClusterFeatures
	Features *proto.Features
	// contains filtered or unexported fields
}

Cluster describes user settings and access to various resources.

func (*Cluster) AssumeRole

func (c *Cluster) AssumeRole(ctx context.Context, req *api.AssumeRoleRequest) error

func (*Cluster) Connected

func (c *Cluster) Connected() bool

Connected indicates if connection to the cluster can be established

func (*Cluster) CreateAccessRequest

func (c *Cluster) CreateAccessRequest(ctx context.Context, req *api.CreateAccessRequestRequest) (*AccessRequest, error)

Creates an access request.

func (*Cluster) CreateGateway

func (c *Cluster) CreateGateway(ctx context.Context, params CreateGatewayParams) (*gateway.Gateway, error)

CreateGateway creates a gateway

func (*Cluster) DeleteAccessRequest

func (c *Cluster) DeleteAccessRequest(ctx context.Context, req *api.DeleteAccessRequestRequest) error

func (*Cluster) GetAccessRequests

func (c *Cluster) GetAccessRequests(ctx context.Context, req types.AccessRequestFilter) ([]AccessRequest, error)

Returns all access requests available to the user.

func (*Cluster) GetAllDatabases

func (c *Cluster) GetAllDatabases(ctx context.Context) ([]Database, error)

GetDatabases returns databases

func (*Cluster) GetAllKubes

func (c *Cluster) GetAllKubes(ctx context.Context) ([]Kube, error)

GetAllKubes returns kube services

func (*Cluster) GetAllServers

func (c *Cluster) GetAllServers(ctx context.Context) ([]Server, error)

GetAllServers returns a full list of servers without pagination or sorting.

func (*Cluster) GetAllowedDatabaseUsers

func (c *Cluster) GetAllowedDatabaseUsers(ctx context.Context, dbURI string) ([]string, error)

GetAllowedDatabaseUsers returns allowed users for the given database based on the role set.

func (*Cluster) GetApps

func (c *Cluster) GetApps(ctx context.Context) ([]App, error)

GetApps returns apps

func (*Cluster) GetClusterFeatures

func (c *Cluster) GetClusterFeatures(ctx context.Context) (*proto.Features, error)

GetClusterFeatures returns a list of features enabled/disabled by the auth server

func (*Cluster) GetDatabase

func (c *Cluster) GetDatabase(ctx context.Context, dbURI string) (*Database, error)

GetDatabase returns a database

func (*Cluster) GetDatabases

func (*Cluster) GetKubes

func (c *Cluster) GetKubes(ctx context.Context, r *api.GetKubesRequest) (*GetKubesResponse, error)

GetKubes returns a paginated kubes list

func (*Cluster) GetLeafClusters

func (c *Cluster) GetLeafClusters(ctx context.Context) ([]LeafCluster, error)

GetLeafClusters returns leaf clusters

func (*Cluster) GetLoggedInUser

func (c *Cluster) GetLoggedInUser() LoggedInUser

GetLoggedInUser returns currently logged-in user

func (*Cluster) GetProxyHost

func (c *Cluster) GetProxyHost() string

GetProxyHost returns proxy address (host:port) of the cluster

func (*Cluster) GetRequestableRoles

func (c *Cluster) GetRequestableRoles(ctx context.Context, req *api.GetRequestableRolesRequest) (*types.AccessCapabilities, error)

GetRequestableRoles returns the requestable roles for the currently logged-in user

func (*Cluster) GetRoles

func (c *Cluster) GetRoles(ctx context.Context) ([]*types.Role, error)

GetRoles returns currently logged-in user roles

func (*Cluster) GetServers

GetServers returns a paginated list of servers.

func (*Cluster) LocalLogin

func (c *Cluster) LocalLogin(ctx context.Context, user, password, otpToken string) error

LocalLogin processes local logins for this cluster

func (*Cluster) Logout

func (c *Cluster) Logout(ctx context.Context) error

Logout deletes all cluster certificates

func (*Cluster) PasswordlessLogin

func (c *Cluster) PasswordlessLogin(ctx context.Context, stream api.TerminalService_LoginPasswordlessServer) error

PasswordlessLogin processes passwordless logins for this cluster.

func (*Cluster) ReissueDBCerts

func (c *Cluster) ReissueDBCerts(ctx context.Context, routeToDatabase tlsca.RouteToDatabase) error

ReissueDBCerts issues new certificates for specific DB access and saves them to disk.

func (*Cluster) ReviewAccessRequest

func (c *Cluster) ReviewAccessRequest(ctx context.Context, req *api.ReviewAccessRequestRequest) (*AccessRequest, error)

func (*Cluster) SSOLogin

func (c *Cluster) SSOLogin(ctx context.Context, providerType, providerName string) error

SSOLogin logs in a user to the Teleport cluster using supported SSO provider

func (*Cluster) SyncAuthPreference

func (c *Cluster) SyncAuthPreference(ctx context.Context) (*webclient.WebConfigAuthSettings, error)

SyncAuthPreference fetches Teleport auth preferences and stores it in the cluster profile

func (*Cluster) TransferFile

func (c *Cluster) TransferFile(ctx context.Context, request *api.FileTransferRequest, sendProgress FileTransferProgressSender) error

type Config

type Config struct {
	// Dir is the directory to store cluster profiles
	Dir string
	// Clock is a clock for time-related operations
	Clock clockwork.Clock
	// InsecureSkipVerify is an option to skip TLS cert check
	InsecureSkipVerify bool
	// Log is a component logger
	Log *logrus.Entry
}

Config is the cluster service config

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

CheckAndSetDefaults checks the configuration for its validity and sets default values if needed

type CreateGatewayParams

type CreateGatewayParams struct {
	// TargetURI is the cluster resource URI
	TargetURI string
	// TargetUser is the target user name
	TargetUser string
	// TargetSubresourceName points at a subresource of the remote resource, for example a database
	// name on a database server.
	TargetSubresourceName string
	// LocalPort is the gateway local port
	LocalPort          string
	CLICommandProvider gateway.CLICommandProvider
	TCPPortAllocator   gateway.TCPPortAllocator
	OnExpiredCert      gateway.OnExpiredCertFunc
}

type Database

type Database struct {
	// URI is the database URI
	URI uri.ResourceURI
	types.Database
}

Database describes database

type DbcmdCLICommandProvider

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

DbcmdCLICommandProvider provides CLI commands for database gateways. It needs Storage to read fresh profile state from the disk.

func NewDbcmdCLICommandProvider

func NewDbcmdCLICommandProvider(storage StorageByResourceURI, execer dbcmd.Execer) DbcmdCLICommandProvider

func (DbcmdCLICommandProvider) GetCommand

func (d DbcmdCLICommandProvider) GetCommand(gateway *gateway.Gateway) (string, error)

type FileTransferProgressSender

type FileTransferProgressSender = func(progress *api.FileTransferProgress) error

type GatewayCreator

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

func NewGatewayCreator

func NewGatewayCreator(resolver Resolver) GatewayCreator

func (GatewayCreator) CreateGateway

func (g GatewayCreator) CreateGateway(ctx context.Context, params CreateGatewayParams) (*gateway.Gateway, error)

type GetDatabasesResponse

type GetDatabasesResponse struct {
	Databases []Database
	// StartKey is the next key to use as a starting point.
	StartKey string
	// // TotalCount is the total number of resources available as a whole.
	TotalCount int
}

type GetKubesResponse

type GetKubesResponse struct {
	Kubes []Kube
	// StartKey is the next key to use as a starting point.
	StartKey string
	// // TotalCount is the total number of resources available as a whole.
	TotalCount int
}

type GetServersResponse

type GetServersResponse struct {
	Servers []Server
	// StartKey is the next key to use as a starting point.
	StartKey string
	// TotalCount is the total number of resources available as a whole.
	TotalCount int
}

type Kube

type Kube struct {
	// URI is the kube URI
	URI uri.ResourceURI

	KubernetesCluster types.KubeCluster
}

Kube describes kubernetes service

type LeafCluster

type LeafCluster struct {
	// URI is the leaf cluster URI
	URI uri.ResourceURI
	// LoggedInUser is the logged in user
	LoggedInUser LoggedInUser
	// Name is the leaf cluster name
	Name string
	// Connected indicates if this leaf cluster is connected
	Connected bool
}

LeafCluster describes a leaf (trusted) cluster

type LoggedInUser

type LoggedInUser struct {
	// Name is the user name
	Name string
	// SSHLogins is the user sshlogins
	SSHLogins []string
	// Roles is the user roles
	Roles []string
	// ActiveRequests is the user active requests
	ActiveRequests []string
}

LoggedInUser is the currently logged-in user

type Resolver

type Resolver interface {
	ResolveCluster(string) (*Cluster, error)
}

type SSHLoginFunc

type SSHLoginFunc func(context.Context, *keys.PrivateKey) (*auth.SSHLoginResponse, error)

type Server

type Server struct {
	// URI is the database URI
	URI uri.ResourceURI

	types.Server
}

Database describes database

type Storage

type Storage struct {
	Config
}

Storage is the cluster storage

func NewStorage

func NewStorage(cfg Config) (*Storage, error)

NewStorage creates an instance of Cluster profile storage.

func (*Storage) Add

func (s *Storage) Add(ctx context.Context, webProxyAddress string) (*Cluster, error)

Add adds a cluster

func (*Storage) GetByResourceURI

func (s *Storage) GetByResourceURI(resourceURI string) (*Cluster, error)

GetByResourceURI returns a cluster by a URI of its resource. Accepts both root and leaf cluster resources and will return a root or leaf cluster accordingly.

func (*Storage) GetByURI

func (s *Storage) GetByURI(clusterURI string) (*Cluster, error)

GetByURI returns a cluster by URI

func (*Storage) ReadAll

func (s *Storage) ReadAll() ([]*Cluster, error)

ReadAll reads clusters from profiles

func (*Storage) Remove

func (s *Storage) Remove(ctx context.Context, profileName string) error

Remove removes a cluster

func (*Storage) ResolveCluster

func (s *Storage) ResolveCluster(resourceURI string) (*Cluster, error)

ResolveCluster is an alias for GetByResourceURI.

type StorageByResourceURI

type StorageByResourceURI interface {
	GetByResourceURI(string) (*Cluster, error)
}

Jump to

Keyboard shortcuts

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