Documentation ¶
Index ¶
- Variables
- func ClientEnsureLoggedIn(ctx context.Context, apikey string, connectorClient connector.ConnectorClient) (connector.LoginResult_Code, error)
- func CommandsToRPC(cmds CommandGroups) *connector.CommandGroups
- func DescribeIntercepts(iis []*manager.InterceptInfo, volumeMountsPrevented error, debug bool) string
- func Disconnect(ctx context.Context, quitUserDaemon, quitRootDaemon bool) (err error)
- func EnsureLoggedIn(ctx context.Context, apikey string) (connector.LoginResult_Code, error)
- func EnsureLoggedOut(ctx context.Context) error
- func ForcedUpdateCheck(cmd *cobra.Command, _ []string) error
- func GetCloudAPIKey(ctx context.Context, description string, autoLogin bool) (string, error)
- func GetCloudLicense(ctx context.Context, outputFile, id string) (string, string, error)
- func GetCloudUserInfo(ctx context.Context, autoLogin bool, refresh bool) (*connector.UserInfo, error)
- func GetTelepresencePro(ctx context.Context) (err error)
- func HasLoggedIn(ctx context.Context) bool
- func Logout(ctx context.Context) error
- func PrepareMount(cwd string, mountPoint string) (string, error)
- func RaiseCloudMessage(cmd *cobra.Command, _ []string) error
- func UpdateCheckIfDue(cmd *cobra.Command, _ []string) error
- func UserDaemonDisconnect(ctx context.Context, quitUserDaemon bool) error
- func WithConnector(ctx context.Context, fn func(context.Context, connector.ConnectorClient) error) error
- func WithManager(ctx context.Context, fn func(context.Context, manager.ManagerClient) error) error
- func WithNetwork(ctx context.Context, fn func(context.Context, daemon.DaemonClient) error) error
- func WithStartedConnector(ctx context.Context, withNotify bool, ...) error
- func WithStartedNetwork(ctx context.Context, fn func(context.Context, daemon.DaemonClient) error) error
- type CommandFuncBundle
- type CommandGroups
- type FlagGroup
- type TypeEnum
- type UpdateChecker
- type Value
Constants ¶
This section is empty.
Variables ¶
var ErrNoNetwork = errors.New("telepresence network is not established")
var ErrNoTrafficManager = errors.New("telepresence traffic manager is not connected")
var ErrNoUserDaemon = errors.New("telepresence user daemon is not running")
var HostRx = regexp.MustCompile(`^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)*$`)
Functions ¶
func ClientEnsureLoggedIn ¶ added in v2.4.10
func ClientEnsureLoggedIn(ctx context.Context, apikey string, connectorClient connector.ConnectorClient) (connector.LoginResult_Code, error)
ClientEnsureLoggedIn is like EnsureLoggedIn but uses an already acquired ConnectorClient.
func CommandsToRPC ¶ added in v2.5.0
func CommandsToRPC(cmds CommandGroups) *connector.CommandGroups
func DescribeIntercepts ¶ added in v2.7.0
func DescribeIntercepts(iis []*manager.InterceptInfo, volumeMountsPrevented error, debug bool) string
func Disconnect ¶ added in v2.5.0
Disconnect shuts down a session in the root daemon. When it shuts down, it will tell the connector to shut down.
func EnsureLoggedIn ¶
EnsureLoggedIn ensures that the user is logged in to Ambassador Cloud. An error is returned if login fails. The result code will indicate if this is a new login or if it re-used an existing login. If the `apikey` argument is empty an interactive login is performed; if it is non-empty the key is used instead of performing an interactive login.
func EnsureLoggedOut ¶
EnsureLoggedOut ensures that the user is logged out of Ambassador Cloud. Returns nil if not logged in.
func ForcedUpdateCheck ¶ added in v2.7.0
func GetCloudAPIKey ¶
func GetCloudLicense ¶ added in v2.2.0
GetCloudLicense communicates with System A to get the jwt version of the license, puts it in a kubernetes secret, and then writes that secret to the output file for the user to apply to their cluster
func GetCloudUserInfo ¶ added in v2.3.7
func GetTelepresencePro ¶ added in v2.5.0
GetTelepresencePro prompts the user to optionally install Telepresence Pro if it isn't installed. If the user installs it, it also asks the user to automatically update their configuration to use the new binary.
func HasLoggedIn ¶
HasLoggedIn returns true if either the user has an active login session or an expired login session, and returns false if either the user has never logged in or has explicitly logged out.
func PrepareMount ¶ added in v2.7.0
func RaiseCloudMessage ¶ added in v2.7.0
raiseCloudMessage is what is called from `PostRunE` in a command and is responsible for raising the message for the command used.
func UserDaemonDisconnect ¶ added in v2.5.0
func WithConnector ¶
func WithConnector(ctx context.Context, fn func(context.Context, connector.ConnectorClient) error) error
WithConnector (1) ensures that the connector is running, (2) establishes a connection to it, and (3) runs the given function with that connection.
It streams to stdout any messages that the connector wants us to display to the user (which WithConnector listens for via the UserNotifications gRPC call). WithConnector does NOT make the "Connect" gRPC call or any other gRPC call except for UserNotifications.
Nested calls to WithConnector will reuse the outer connection.
func WithManager ¶ added in v2.3.3
func WithNetwork ¶ added in v2.5.0
WithNetwork (1) ensures that the daemon is running, (2) establishes a connection to it, and (3) runs the given function with that connection.
Nested calls to WithNetwork will reuse the outer connection.
func WithStartedConnector ¶ added in v2.3.3
func WithStartedConnector(ctx context.Context, withNotify bool, fn func(context.Context, connector.ConnectorClient) error) error
WithStartedConnector is like WithConnector, but returns ErrNoUserDaemon if the connector is not already running, rather than starting it.
func WithStartedNetwork ¶ added in v2.5.0
func WithStartedNetwork(ctx context.Context, fn func(context.Context, daemon.DaemonClient) error) error
WithStartedNetwork is like WithNetwork, but returns ErrNoNetwork if the daemon is not already running, rather than starting it.
Types ¶
type CommandFuncBundle ¶ added in v2.7.2
type CommandGroups ¶ added in v2.5.0
func RPCToCommands ¶ added in v2.5.0
func RPCToCommands(remote *connector.CommandGroups, funcBundle CommandFuncBundle) (CommandGroups, error)
type TypeEnum ¶ added in v2.5.0
type TypeEnum string
TypeEnum is an enum-string that identifies the datatype to use both for (1) parsing the default value of a flag, and for (2) validating and normalizing the flag value that the user passes on the CLI.
See the `flagTypes` variable in `flagtypes.go` for a listing of valid values.
func TypeFromString ¶ added in v2.5.0
func (TypeEnum) NewFlagValueFromJson ¶ added in v2.5.0
func (TypeEnum) NewFlagValueFromPFlagString ¶ added in v2.5.0
func (*TypeEnum) UnmarshalJSON ¶ added in v2.5.0
type UpdateChecker ¶ added in v2.7.0
type UpdateChecker struct { NextCheck map[string]time.Time `json:"next_check"` // contains filtered or unexported fields }
func NewUpdateChecker ¶ added in v2.7.0
func NewUpdateChecker(ctx context.Context, url string) (*UpdateChecker, error)
newUpdateChecker returns a new update checker, possibly initialized from the users cache.