Documentation ¶
Index ¶
- func FormatLabels(labels map[string]string, verbose bool) string
- func FormatResourceName(r types.ResourceWithLabels, verbose bool) string
- func ShowClusterAlerts(ctx context.Context, client ClusterAlertGetter, w io.Writer, ...) error
- func ShowSessions(events []events.AuditEvent, format string, w io.Writer) error
- type ClusterAlertGetter
- type ExitCodeError
- type SessionsCollection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatLabels ¶
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 ¶
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.