common

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLabels

func FormatLabels(labels map[string]string, verbose bool) string

FormatLabels filters out Teleport namespaced (teleport.[dev|hidden|internal]) labels in non-verbose mode, groups the labels by namespace, sorts each group, then re-combines the groups and returns the result as a comma separated string.

func FormatResourceName

func FormatResourceName(r types.ResourceWithLabels, verbose bool) string

FormatResourceName returns the resource's name or its name as originally discovered in the cloud by the Teleport Discovery Service. In verbose mode, it always returns the resource name. In non-verbose mode, if the resource came from discovery and has the discovered name label, it returns the discovered name.

func ShowClusterAlerts

func ShowClusterAlerts(ctx context.Context, client ClusterAlertGetter, w io.Writer, labels map[string]string, severity types.AlertSeverity) error

ShowClusterAlerts shows cluster alerts matching the given labels and minimum severity.

func ShowSessions

func ShowSessions(events []events.AuditEvent, format string, w io.Writer) error

ShowSessions is a helper function for displaying listed sessions via tsh or tctl.

Types

type ClusterAlertGetter

type ClusterAlertGetter interface {
	GetClusterAlerts(ctx context.Context, query types.GetClusterAlertsRequest) ([]types.ClusterAlert, error)
}

ClusterAlertGetter manages getting cluster alerts.

type ExitCodeError

type ExitCodeError struct {
	// Code is the exit code
	Code int
}

ExitCodeError wraps an exit code as an error.

func (*ExitCodeError) Error

func (e *ExitCodeError) Error() string

Error implements the error interface.

type SessionsCollection

type SessionsCollection struct {
	SessionEvents []events.AuditEvent
}

SessionsCollection is a collection of session end events.

func (*SessionsCollection) WriteJSON

func (e *SessionsCollection) WriteJSON(w io.Writer) error

WriteJSON writes the session collection as JSON to the provided io.Writer.

func (*SessionsCollection) WriteText

func (e *SessionsCollection) WriteText(w io.Writer) error

WriteText writes the session collection as text to the provided io.Writer.

func (*SessionsCollection) WriteYAML

func (e *SessionsCollection) WriteYAML(w io.Writer) error

WriteYAML writes the session collection as YAML to the provided io.Writer.

Jump to

Keyboard shortcuts

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