ui

package
v1.2.3-fred.1 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: 18 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssembleAppFQDN

func AssembleAppFQDN(localClusterName string, localProxyDNSName string, appClusterName string, app types.Application) string

AssembleAppFQDN returns the application's FQDN.

If the application is running within the local cluster and it has a public address specified, the application's public address is used.

In all other cases, i.e. if the public address is not set or the application is running in a remote cluster, the FQDN is formatted as <appName>.<localProxyDNSName>

Types

type AccessCapabilities

type AccessCapabilities struct {
	// RequestableRoles is a list of roles that the user can select when requesting access.
	RequestableRoles []string `json:"requestableRoles"`
	// SuggestedReviewers is a list of reviewers that the user can select when creating a request.
	SuggestedReviewers []string `json:"suggestedReviewers"`
}

AccessCapabilities defines allowable access request rules defined in a user's roles.

type App

type App struct {
	// Name is the name of the application.
	Name string `json:"name"`
	// Description is the app description.
	Description string `json:"description"`
	// URI is the internal address the application is available at.
	URI string `json:"uri"`
	// PublicAddr is the public address the application is accessible at.
	PublicAddr string `json:"publicAddr"`
	// FQDN is a fully qualified domain name of the application (app.example.com)
	FQDN string `json:"fqdn"`
	// ClusterID is this app cluster ID
	ClusterID string `json:"clusterId"`
	// Labels is a map of static labels associated with an application.
	Labels []Label `json:"labels"`
	// AWSConsole if true, indicates that the app represents AWS management console.
	AWSConsole bool `json:"awsConsole"`
	// AWSRoles is a list of AWS IAM roles for the application representing AWS console.
	AWSRoles []aws.Role `json:"awsRoles,omitempty"`
}

App describes an application

func MakeApps

func MakeApps(c MakeAppsConfig) []App

MakeApps creates server application objects

type Cluster

type Cluster struct {
	// Name is the cluster name
	Name string `json:"name"`
	// LastConnected is the cluster last connected time
	LastConnected time.Time `json:"lastConnected"`
	// Status is the cluster status
	Status string `json:"status"`
	// NodeCount is this cluster number of registered servers
	NodeCount int `json:"nodeCount"`
	// PublicURL is this cluster public URL (its first available proxy URL),
	// or possibly empty if no proxies could be loaded.
	PublicURL string `json:"publicURL"`
	// AuthVersion is the cluster auth's service version
	AuthVersion string `json:"authVersion"`
	// ProxyVersion is the cluster proxy's service version,
	// or possibly empty if no proxies could be loaded.
	ProxyVersion string `json:"proxyVersion"`
}

Cluster describes a cluster

func GetClusterDetails

func GetClusterDetails(ctx context.Context, site reversetunnel.RemoteSite, opts ...services.MarshalOption) (*Cluster, error)

GetClusterDetails retrieves and sets details about a cluster

func NewClusters

func NewClusters(remoteClusters []reversetunnel.RemoteSite) ([]Cluster, error)

NewClusters creates a slice of Cluster's, containing data about each cluster.

func NewClustersFromRemote

func NewClustersFromRemote(remoteClusters []types.RemoteCluster) ([]Cluster, error)

NewClustersFromRemote creates a slice of Cluster's, containing data about each cluster.

type ConnectionDiagnostic

type ConnectionDiagnostic struct {
	// ID is the identifier of the connection diagnostic.
	ID string `json:"id"`
	// Success is whether the connection was successful
	Success bool `json:"success"`
	// Message is the diagnostic summary
	Message string `json:"message"`
	// Traces contains multiple checkpoints results
	Traces []ConnectionDiagnosticTraceUI `json:"traces,omitempty"`
}

ConnectionDiagnostic describes a connection diagnostic.

type ConnectionDiagnosticTraceUI

type ConnectionDiagnosticTraceUI struct {
	// TraceType as string
	TraceType string `json:"traceType,omitempty"`
	// Status as string
	Status string `json:"status,omitempty"`
	// Details of the trace
	Details string `json:"details,omitempty"`
	// Error in case of failure
	Error string `json:"error,omitempty"`
}

ConnectionDiagnosticTraceUI describes a connection diagnostic trace using a UI representation. This is required in order to have a more friendly representation of the enum fields - TraceType and Status. They are converted into string instead of using the numbers (as they are represented in gRPC).

func ConnectionDiagnosticTraceUIFromTypes

func ConnectionDiagnosticTraceUIFromTypes(traces []*types.ConnectionDiagnosticTrace) []ConnectionDiagnosticTraceUI

ConnectionDiagnosticTraceUIFromTypes converts a list of ConnectionDiagnosticTrace into its format for HTTP API. This is mostly copying things around and converting the enum into a string value.

type Database

type Database struct {
	// Name is the name of the database.
	Name string `json:"name"`
	// Desc is the database description.
	Desc string `json:"desc"`
	// Protocol is the database description.
	Protocol string `json:"protocol"`
	// Type is the database type, self-hosted or cloud-hosted.
	Type string `json:"type"`
	// Labels is a map of static and dynamic labels associated with a database.
	Labels []Label `json:"labels"`
}

Database describes a database server.

func MakeDatabases

func MakeDatabases(clusterName string, databases []types.Database) []Database

MakeDatabases creates database objects.

type Desktop

type Desktop struct {
	// OS is the os of this desktop. Should be one of constants.WindowsOS, constants.LinuxOS, or constants.DarwinOS.
	OS string `json:"os"`
	// Name is name (uuid) of the windows desktop.
	Name string `json:"name"`
	// Addr is the network address the desktop can be reached at.
	Addr string `json:"addr"`
	// Labels is a map of static and dynamic labels associated with a desktop.
	Labels []Label `json:"labels"`
	// HostID is the ID of the Windows Desktop Service reporting the desktop.
	HostID string `json:"host_id"`
}

Desktop describes a desktop to pass to the ui.

func MakeDesktop

func MakeDesktop(windowsDesktop types.WindowsDesktop) Desktop

MakeDesktop converts a desktop from its API form to a type the UI can display.

func MakeDesktops

func MakeDesktops(windowsDesktops []types.WindowsDesktop) []Desktop

MakeDesktops converts desktops from their API form to a type the UI can display.

type DesktopService

type DesktopService struct {
	// Name is hostname of the Windows Desktop Service.
	Name string `json:"name"`
	// Hostname is hostname of the Windows Desktop Service.
	Hostname string `json:"hostname"`
	// Addr is the network address the Windows Desktop Service can be reached at.
	Addr string `json:"addr"`
	// Labels is a map of static and dynamic labels associated with a desktop.
	Labels []Label `json:"labels"`
}

DesktopService describes a desktop service to pass to the ui.

func MakeDesktopService

func MakeDesktopService(desktopService types.WindowsDesktopService) DesktopService

MakeDesktop converts a desktop from its API form to a type the UI can display.

func MakeDesktopServices

func MakeDesktopServices(windowsDesktopServices []types.WindowsDesktopService) []DesktopService

MakeDesktopServices converts desktops from their API form to a type the UI can display.

type KubeCluster

type KubeCluster struct {
	// Name is the name of the kube cluster.
	Name string `json:"name"`
	// Labels is a map of static and dynamic labels associated with an kube cluster.
	Labels []Label `json:"labels"`
}

KubeCluster describes a kube cluster.

func MakeKubeClusters

func MakeKubeClusters(clusters []types.KubeCluster) []KubeCluster

MakeKubes creates ui kube objects and returns a list..

type Label

type Label struct {
	// Name is this label name
	Name string `json:"name"`
	// Value is this label value
	Value string `json:"value"`
}

Label describes label for webapp

type MFADevice

type MFADevice struct {
	// ID is the device ID.
	ID string `json:"id"`
	// Name is the device name.
	Name string `json:"name"`
	// Type is the device type.
	Type string `json:"type"`
	// LastUsed is the time the user used the device last.
	LastUsed time.Time `json:"lastUsed"`
	// AddedAt is the time the user registered the device.
	AddedAt time.Time `json:"addedAt"`
}

MFADevice describes a mfa device

func MakeMFADevices

func MakeMFADevices(devices []*types.MFADevice) []MFADevice

MakeMFADevices creates a UI list of mfa devices.

type MakeAppsConfig

type MakeAppsConfig struct {
	// LocalClusterName is the name of the local cluster.
	LocalClusterName string
	// LocalProxyDNSName is the public hostname of the local cluster.
	LocalProxyDNSName string
	// AppClusterName is the name of the cluster apps reside in.
	AppClusterName string
	// Apps is a list of registered apps.
	Apps types.Apps
	// Identity is identity of the logged in user.
	Identity *tlsca.Identity
}

MakeAppsConfig contains parameters for converting apps to UI representation.

type RecoveryCodes

type RecoveryCodes struct {
	// Codes are user's new recovery codes.
	Codes []string `json:"codes,omitempty"`
	// Created is when the codes were created.
	Created *time.Time `json:"created,omitempty"`
}

RecoveryCodes describes RecoveryCodes UI object.

type ResetPasswordToken

type ResetPasswordToken struct {
	// TokenID is token ID
	TokenID string `json:"tokenId"`
	// User is user name associated with this token
	User string `json:"user"`
	// QRCode is a QR code value
	QRCode []byte `json:"qrCode,omitempty"`
	// Expiry is token expiration time
	Expiry time.Time `json:"expiry,omitempty"`
}

ResetPasswordToken describes a reset password token UI object.

type ResourceItem

type ResourceItem struct {
	// ID is a resource ID which is a composed value based on kind and name.
	// It is a composed value because while a resource name is unique to that resource,
	// the name can be the same for different resource type.
	ID string `json:"id"`
	// Kind is a resource kind.
	Kind string `json:"kind"`
	// Name is a resource name.
	Name string `json:"name"`
	// Content is resource yaml content.
	Content string `json:"content"`
}

ResourceItem is UI representation of a resource (roles, trusted clusters, auth connectors).

func NewGithubConnectors

func NewGithubConnectors(connectors []types.GithubConnector) ([]ResourceItem, error)

NewGithubConnectors creates resource item for each github connector.

func NewResourceItem

func NewResourceItem(resource types.Resource) (*ResourceItem, error)

NewResourceItem creates UI objects for a resource.

func NewRoles

func NewRoles(roles []types.Role) ([]ResourceItem, error)

NewRoles creates resource item for each role.

func NewTrustedClusters

func NewTrustedClusters(clusters []types.TrustedCluster) ([]ResourceItem, error)

NewTrustedClusters creates resource item for each cluster.

type Server

type Server struct {
	// Tunnel indicates of this server is connected over a reverse tunnel.
	Tunnel bool `json:"tunnel"`
	// Name is this server name
	Name string `json:"id"`
	// ClusterName is this server cluster name
	ClusterName string `json:"siteId"`
	// Hostname is this server hostname
	Hostname string `json:"hostname"`
	// Addrr is this server ip address
	Addr string `json:"addr"`
	// Labels is this server list of labels
	Labels []Label `json:"tags"`
	// SSHLogins is the list of logins this user can use on this server
	SSHLogins []string `json:"sshLogins"`
}

Server describes a server for webapp

func MakeServers

func MakeServers(clusterName string, servers []types.Server, userRoles services.RoleSet) []Server

MakeServers creates server objects for webapp

type User

type User struct {
	UserListEntry
	// Traits contain fields that define traits for local accounts.
	Traits userTraits `json:"traits"`
}

User contains data needed by the web UI to display locally saved users.

func NewUser

func NewUser(teleUser types.User) (*User, error)

NewUser creates UI user object

type UserContext

type UserContext struct {
	// AuthType is auth method of this user.
	AuthType authType `json:"authType"`
	// Name is this user name.
	Name string `json:"userName"`
	// ACL contains user access control list.
	ACL userACL `json:"userAcl"`
	// Cluster contains cluster detail for this user's context.
	Cluster *Cluster `json:"cluster"`
	// AccessStrategy describes how a user should access teleport resources.
	AccessStrategy accessStrategy `json:"accessStrategy"`
	// AccessCapabilities defines allowable access request rules defined in a user's roles.
	AccessCapabilities AccessCapabilities `json:"accessCapabilities"`
	// ConsumedAccessRequestID is the request ID of the access request from which the assumed role was
	// obtained
	ConsumedAccessRequestID string `json:"accessRequestId,omitempty"`
}

UserContext describes user settings and access to various resources.

func NewUserContext

func NewUserContext(user types.User, userRoles services.RoleSet, features proto.Features, desktopRecordingEnabled bool) (*UserContext, error)

NewUserContext returns user context

type UserListEntry

type UserListEntry struct {
	// Name is the user name.
	Name string `json:"name"`
	// Roles is the list of roles user belongs to.
	Roles []string `json:"roles"`
	// AuthType is the type of auth service
	// that the user was authenticated through.
	AuthType string `json:"authType"`
}

func NewUserListEntry

func NewUserListEntry(teleUser types.User) (*UserListEntry, error)

Jump to

Keyboard shortcuts

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