daemon

package
v1.2.3-fred.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Storage is a storage service that reads/writes to tsh profiles
	Storage *clusters.Storage
	// Log is a component logger
	Log              *logrus.Entry
	GatewayCreator   GatewayCreator
	TCPPortAllocator gateway.TCPPortAllocator
}

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             string
	TargetUser            string
	TargetSubresourceName string
	LocalPort             string
}

type GatewayCreator

type GatewayCreator interface {
	CreateGateway(context.Context, clusters.CreateGatewayParams) (*gateway.Gateway, error)
}

type Service

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

Service is the daemon service

func New

func New(cfg Config) (*Service, error)

New creates an instance of Daemon service

func (*Service) AddCluster

func (s *Service) AddCluster(ctx context.Context, webProxyAddress string) (*clusters.Cluster, error)

AddCluster adds a cluster

func (*Service) AssumeRole

func (s *Service) AssumeRole(ctx context.Context, req *api.AssumeRoleRequest) error

func (*Service) ClusterLogout

func (s *Service) ClusterLogout(ctx context.Context, uri string) error

ClusterLogout logs a user out from the cluster

func (*Service) CreateAccessRequest

func (s *Service) CreateAccessRequest(ctx context.Context, req *api.CreateAccessRequestRequest) (*clusters.AccessRequest, error)

CreateAccessRequest creates an access request

func (*Service) CreateGateway

func (s *Service) CreateGateway(ctx context.Context, params CreateGatewayParams) (*gateway.Gateway, error)

CreateGateway creates a gateway to given targetURI

func (*Service) DeleteAccessRequest

func (s *Service) DeleteAccessRequest(ctx context.Context, req *api.DeleteAccessRequestRequest) error

func (*Service) GetAccessRequest

func (s *Service) GetAccessRequest(ctx context.Context, req *api.GetAccessRequestRequest) ([]clusters.AccessRequest, error)

GetAccessRequest returns AccessRequests filtered by ID

func (*Service) GetAccessRequests

func (s *Service) GetAccessRequests(ctx context.Context, req *api.GetAccessRequestsRequest) ([]clusters.AccessRequest, error)

GetAccessRequests returns all access requests with filtered input

func (*Service) GetAllKubes

func (s *Service) GetAllKubes(ctx context.Context, uri string) ([]clusters.Kube, error)

GetAllKubes lists kubernetes clusters

func (*Service) GetAllServers

func (s *Service) GetAllServers(ctx context.Context, clusterURI string) ([]clusters.Server, error)

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

func (*Service) GetKubes

GetKubes accepts parameterized input to enable searching, sorting, and pagination.

func (*Service) GetRequestableRoles

func (*Service) GetServers

GetServers accepts parameterized input to enable searching, sorting, and pagination.

func (*Service) ListApps

func (s *Service) ListApps(ctx context.Context, clusterURI string) ([]clusters.App, error)

ListServers returns cluster servers

func (*Service) ListGateways

func (s *Service) ListGateways() []gateway.Gateway

ListGateways lists gateways

func (*Service) ListLeafClusters

func (s *Service) ListLeafClusters(ctx context.Context, uri string) ([]clusters.LeafCluster, error)

ListLeafClusters returns a list of leaf clusters

func (*Service) ListRootClusters

func (s *Service) ListRootClusters(ctx context.Context) ([]*clusters.Cluster, error)

ListRootClusters returns a list of root clusters

func (*Service) RemoveCluster

func (s *Service) RemoveCluster(ctx context.Context, uri string) error

RemoveCluster removes cluster

func (*Service) RemoveGateway

func (s *Service) RemoveGateway(gatewayURI string) error

RemoveGateway removes cluster gateway

func (*Service) ResolveCluster

func (s *Service) ResolveCluster(uri string) (*clusters.Cluster, error)

ResolveCluster resolves a cluster by URI

func (*Service) RestartGateway

func (s *Service) RestartGateway(ctx context.Context, gatewayURI string) error

RestartGateway stops a gateway and starts a new one with identical parameters. It also keeps the original URI so that from the perspective of Connect it's still the same gateway but with fresh certs.

func (*Service) ReviewAccessRequest

func (s *Service) ReviewAccessRequest(ctx context.Context, req *api.ReviewAccessRequestRequest) (*clusters.AccessRequest, error)

func (*Service) SetGatewayLocalPort

func (s *Service) SetGatewayLocalPort(gatewayURI, localPort string) (*gateway.Gateway, error)

SetGatewayLocalPort creates a new gateway with the given port, swaps it with the old gateway under the same URI in s.gateways and then closes the old gateway. It doesn't fetch a fresh db cert.

If gateway.NewWithLocalPort fails it's imperative that the current gateway is kept intact. This way if the user attempts to change the port to one that cannot be obtained, they're able to correct that mistake and choose a different port.

SetGatewayLocalPort is a noop if port is equal to the existing port.

func (*Service) SetGatewayTargetSubresourceName

func (s *Service) SetGatewayTargetSubresourceName(gatewayURI, targetSubresourceName string) (*gateway.Gateway, error)

SetGatewayTargetSubresourceName updates the TargetSubresourceName field of a gateway stored in s.gateways.

func (*Service) Stop

func (s *Service) Stop()

Stop terminates all cluster open connections

func (*Service) TransferFile

func (s *Service) TransferFile(ctx context.Context, request *api.FileTransferRequest, sendProgress clusters.FileTransferProgressSender) error

Jump to

Keyboard shortcuts

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