cliutil

package
v2.8.3-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUserDaemon     = errors.New("telepresence user daemon is not running")
	ErrNoRootDaemon     = errors.New("telepresence root daemon is not running")
	ErrNoTrafficManager = errors.New("telepresence traffic manager is not connected")
)
View Source
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 AddKubeconfigEnv added in v2.8.0

func AddKubeconfigEnv(cr *connector.ConnectRequest)

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

func Disconnect(ctx context.Context, quitDaemons bool) error

Disconnect shuts down a session in the root daemon. When it shuts down, it will tell the connector to shut down.

func EnsureLoggedIn

func EnsureLoggedIn(ctx context.Context, apikey string) (connector.LoginResult_Code, error)

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

func EnsureLoggedOut(ctx context.Context) error

EnsureLoggedOut ensures that the user is logged out of Ambassador Cloud. Returns nil if not logged in.

func EnsureRootDaemonRunning added in v2.8.0

func EnsureRootDaemonRunning(ctx context.Context) error

EnsureRootDaemonRunning ensures that the daemon is running.

func ForcedUpdateCheck added in v2.7.0

func ForcedUpdateCheck(cmd *cobra.Command, _ []string) error

func GetCloudLicense added in v2.2.0

func GetCloudLicense(ctx context.Context, outputFile, id string) (string, string, error)

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 GetCloudUserInfo(ctx context.Context, autoLogin bool, refresh bool) (*connector.UserInfo, error)

func GetConnectRequest added in v2.8.0

func GetConnectRequest(ctx context.Context) *connector.ConnectRequest

func HasLoggedIn

func HasLoggedIn(ctx context.Context) bool

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 InitCommand added in v2.8.0

func InitCommand(cmd *cobra.Command) (err error)

func Logout

func Logout(ctx context.Context) error

Logout logs out of Ambassador Cloud. Returns an error if not logged in.

func PrepareMount added in v2.7.0

func PrepareMount(cwd string, mountPoint string) (string, error)

func RaiseCloudMessage added in v2.7.0

func RaiseCloudMessage(cmd *cobra.Command, _ []string) error

RaiseCloudMessage is what is called from `PostRunE` in a command and is responsible for raising the message for the command used.

func UpdateCheckIfDue added in v2.7.0

func UpdateCheckIfDue(cmd *cobra.Command, _ []string) error

func UserDaemonDisconnect added in v2.5.0

func UserDaemonDisconnect(ctx context.Context, quitDaemons bool) (err error)

func WithConnectionRequest added in v2.8.0

func WithConnectionRequest(ctx context.Context, rq *connector.ConnectRequest) context.Context

func WithManager added in v2.3.3

func WithManager(ctx context.Context, fn func(context.Context, manager.ManagerClient) error) error

Types

type CommandFuncBundle added in v2.7.2

type CommandFuncBundle struct {
	RunE              func(*cobra.Command, []string) error
	ValidArgsFunction func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)
}

type CommandGroups added in v2.5.0

type CommandGroups map[string][]*cobra.Command

func RPCToCommands added in v2.5.0

func RPCToCommands(remote *connector.CommandGroups, funcBundle CommandFuncBundle) (CommandGroups, error)

type FlagGroup added in v2.5.0

type FlagGroup struct {
	Name  string
	Flags *pflag.FlagSet
}

FlagGroup represents a group of flags and the name of that group.

type Session added in v2.8.0

type Session struct {
	UserDaemon
	Info    *connector.ConnectInfo
	Started bool
}

func GetSession added in v2.8.0

func GetSession(ctx context.Context) *Session

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 TypeFromString(s string) (TypeEnum, error)

func (TypeEnum) NewFlagValueFromJson added in v2.5.0

func (t TypeEnum) NewFlagValueFromJson(untypedDefault any) (Value, error)

func (TypeEnum) NewFlagValueFromPFlagString added in v2.5.0

func (t TypeEnum) NewFlagValueFromPFlagString(stringDefault string) (Value, error)

func (*TypeEnum) UnmarshalJSON added in v2.5.0

func (t *TypeEnum) UnmarshalJSON(dat []byte) error

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.

func (*UpdateChecker) StoreNextCheck added in v2.7.0

func (uc *UpdateChecker) StoreNextCheck(ctx context.Context, d time.Duration) error

func (*UpdateChecker) UpdateAvailable added in v2.7.0

func (uc *UpdateChecker) UpdateAvailable(currentVersion *semver.Version, errOut io.Writer) (*semver.Version, bool)

type UserDaemon added in v2.8.0

type UserDaemon struct {
	connector.ConnectorClient
	Conn *grpc.ClientConn
}

func GetUserDaemon added in v2.8.0

func GetUserDaemon(ctx context.Context) *UserDaemon

type Value added in v2.5.0

type Value interface {
	pflag.Value
	AsArgs(flagname string) []string
}

Jump to

Keyboard shortcuts

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