ctx

package
v0.30.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewList

func NewList(items []list.Item) list.Model

Types

type Accepting

type Accepting interface {
	NavigationState
	Accept(writer kubeContextWriter) (string, error)
}

Accepting is a model state that provides a method to accept a navigation node.

type AcceptingFunc

type AcceptingFunc func(ctx context.Context, upCtx *upbound.Context) error

func (AcceptingFunc) Accept

func (f AcceptingFunc) Accept(ctx context.Context, upCtx *upbound.Context) error

type Back

type Back interface {
	NavigationState
	Back(m model) (model, error)
	CanBack() bool
}

Back is a model state that provides a method to go back to the parent navigation node.

type Cmd

type Cmd struct {
	// Common Upbound API configuration
	Flags upbound.Flags `embed:""`

	Argument    string `` /* 132-byte string literal not displayed */
	Short       bool   `short:"s" env:"UP_SHORT" name:"short" help:"Short output."`
	KubeContext string `env:"UP_CONTEXT" default:"upbound" name:"context" help:"Kubernetes context to operate on."`
	File        string `short:"f" name:"kubeconfig" help:"Kubeconfig to modify when saving a new context"`
}

func (*Cmd) AfterApply

func (c *Cmd) AfterApply(kongCtx *kong.Context) error

func (*Cmd) Run

func (c *Cmd) Run(ctx context.Context, kongCtx *kong.Context, upCtx *upbound.Context) error

func (*Cmd) RunInteractive

func (c *Cmd) RunInteractive(ctx context.Context, kongCtx *kong.Context, upCtx *upbound.Context, initialState NavigationState) error

func (*Cmd) RunRelative

func (c *Cmd) RunRelative(ctx context.Context, upCtx *upbound.Context, initialState NavigationState) error

func (*Cmd) RunSwap

func (c *Cmd) RunSwap(ctx context.Context, upCtx *upbound.Context) error

type ControlPlane

type ControlPlane struct {
	Group Group
	Name  string
}

ControlPlane provides the navigation node for a concrete controlplane.

func (*ControlPlane) Accept

func (ctp *ControlPlane) Accept(writer kubeContextWriter) (msg string, err error)

Accept upserts a controlplane context and cluster to the chosen kubeconfig.

func (*ControlPlane) Back

func (ctp *ControlPlane) Back(m model) (model, error)

func (*ControlPlane) Breadcrumbs

func (ctp *ControlPlane) Breadcrumbs() string

func (*ControlPlane) CanBack

func (ctp *ControlPlane) CanBack() bool

func (*ControlPlane) Items

func (ctp *ControlPlane) Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)

func (*ControlPlane) NamespacedName

func (ctp *ControlPlane) NamespacedName() types.NamespacedName

type Group

type Group struct {
	Space Space
	Name  string
}

Group provides the navigation node for a concrete group aka namespace.

func (*Group) Accept

func (g *Group) Accept(writer kubeContextWriter) (msg string, err error)

Accept upserts the "upbound" kubeconfig context and cluster to the chosen kubeconfig, pointing to the group.

func (*Group) Back

func (g *Group) Back(m model) (model, error)

func (*Group) Breadcrumbs

func (g *Group) Breadcrumbs() string

func (*Group) CanBack

func (g *Group) CanBack() bool

func (*Group) Items

func (g *Group) Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)

type KeyFunc

type KeyFunc func(m model) (model, error)
type NavigationState interface {
	Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)
	Breadcrumbs() string
}

NavigationState is a model state that provides a list of items for a navigation node.

func DeriveCloudState

func DeriveCloudState(upCtx *upbound.Context, conf *clientcmdapi.Config) (NavigationState, error)

func DeriveSelfHostedState

func DeriveSelfHostedState(conf *clientcmdapi.Config, ingress string, ca []byte, ctp types.NamespacedName) (NavigationState, error)

func DeriveState

func DeriveState(ctx context.Context, upCtx *upbound.Context, conf *clientcmdapi.Config) (NavigationState, error)

type Organization

type Organization struct {
	Name string
}

func (*Organization) Back

func (o *Organization) Back(m model) (model, error)

func (*Organization) Breadcrumbs

func (o *Organization) Breadcrumbs() string

func (*Organization) CanBack

func (o *Organization) CanBack() bool

func (*Organization) Items

func (o *Organization) Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)

type Root

type Root struct{}

func (*Root) Breadcrumbs

func (r *Root) Breadcrumbs() string

func (*Root) Items

func (r *Root) Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)

type Space

type Space struct {
	Org  Organization
	Name string

	Ingress  string
	CA       []byte
	AuthInfo *clientcmdapi.AuthInfo
}

Space provides the navigation node for a space.

func (*Space) Accept

func (s *Space) Accept(writer kubeContextWriter) (msg string, err error)

Accept upserts the "upbound" kubeconfig context and cluster to the chosen kubeconfig, pointing to the space.

func (*Space) Back

func (s *Space) Back(m model) (model, error)

func (*Space) Breadcrumbs

func (s *Space) Breadcrumbs() string

func (*Space) CanBack

func (s *Space) CanBack() bool

func (*Space) GetClient

func (s *Space) GetClient() (client.Client, error)

GetClient returns a kube client pointed at the current space

func (*Space) IsCloud

func (s *Space) IsCloud() bool

func (*Space) Items

func (s *Space) Items(ctx context.Context, upCtx *upbound.Context) ([]list.Item, error)

type Termination

type Termination struct {
	Err     error
	Message string
}

Termination is a model state that indicates the command should be terminated, optionally with a message and an error.

Jump to

Keyboard shortcuts

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