Documentation ¶
Index ¶
- Variables
- func DidLaunchConnector(ctx context.Context) bool
- func DidLaunchDaemon(ctx context.Context) bool
- func EnsureLoggedIn(ctx context.Context, apikey string) (connector.LoginResult_Code, error)
- func EnsureLoggedOut(ctx context.Context) 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 HasLoggedIn(ctx context.Context) bool
- func Logout(ctx context.Context) error
- func QuitConnector(ctx context.Context) error
- func QuitDaemon(ctx context.Context) (err error)
- func WithConnector(ctx context.Context, fn func(context.Context, connector.ConnectorClient) error) error
- func WithDaemon(ctx context.Context, dnsIP string, ...) error
- func WithManager(ctx context.Context, fn func(context.Context, manager.ManagerClient) error) error
- func WithStartedConnector(ctx context.Context, fn func(context.Context, connector.ConnectorClient) error) error
- func WithStartedDaemon(ctx context.Context, fn func(context.Context, daemon.DaemonClient) error) error
Constants ¶
This section is empty.
Variables ¶
var ErrNoConnector = errors.New("telepresence user daemon is not running")
var ErrNoDaemon = errors.New("telepresence root daemon is not running")
Functions ¶
func DidLaunchConnector ¶ added in v2.3.3
DidLaunchConnector returns whether WithConnector launched the connector or merely connected to a running instance. If there are nested calls to WithConnector, it returns the answer for the inner-most call; even if the outer-most call launches the connector false will be returned.
func DidLaunchDaemon ¶ added in v2.3.3
DidLaunchDaemon returns whether WithDaemon launched the daemon or merely connected to a running instance. If there are nested calls to WithDaemon, it returns the answer for the inner-most call; even if the outer-most call launches the daemon false will be returned.
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 resued 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 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 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 QuitConnector ¶
func QuitDaemon ¶ added in v2.3.3
QuitDaemon shuts down the root daemon. When it shuts down, it will tell the connector to shut down.
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 WithDaemon ¶ added in v2.3.3
func WithDaemon(ctx context.Context, dnsIP string, fn func(context.Context, daemon.DaemonClient) error) error
WithDaemon (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 WithDaemon will reuse the outer connection.
func WithManager ¶ added in v2.3.3
func WithStartedConnector ¶ added in v2.3.3
func WithStartedConnector(ctx context.Context, fn func(context.Context, connector.ConnectorClient) error) error
WithStartedConnector is like WithConnector, but returns ErrNoConnector if the connector is not already running, rather than starting it.
func WithStartedDaemon ¶ added in v2.3.3
func WithStartedDaemon(ctx context.Context, fn func(context.Context, daemon.DaemonClient) error) error
WithStartedDaemon is like WithDaemon, but returns ErrNoDaemon if the daemon is not already running, rather than starting it.
Types ¶
This section is empty.