cmd

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSubCommand added in v1.8.1

func FindSubCommand(cmd *cobra.Command, name ...string) *cobra.Command

func RunParentPreRunE added in v1.8.1

func RunParentPreRunE(cmd *cobra.Command, args []string) error

RunParentPreRunE checks if the parent command has a PersistentPreRunE set and executes it. This is for use in PersistentPreRun and is necessary because only the first PersistentPreRun* of the command's ancestors is executed by cobra.

func WrapRunnables

func WrapRunnables(cmd *cobra.Command, wrapper RunnableWrapper)

Types

type ConfigType added in v1.8.1

type ConfigType int
const (
	FileConfig ConfigType = iota
	InMemory
)

type RootArgs

type RootArgs struct {
	ConfigFile string
	ConfigType ConfigType
	Mesh       string
	ApiTimeout time.Duration
}

type RootContext

type RootContext struct {
	Args                                RootArgs
	Runtime                             RootRuntime
	GetContext                          get_context.GetContext
	ListContext                         get_context.ListContext
	GenerateContext                     generate_context.GenerateContext
	InspectContext                      inspect_context.InspectContext
	InstallCpContext                    install_context.InstallCpContext
	InstallObservabilityContext         install_context.InstallObservabilityContext
	InstallMetricsContext               install_context.InstallMetricsContext
	InstallCRDContext                   install_context.InstallCrdsContext
	InstallDemoContext                  install_context.InstallDemoContext
	InstallGatewayKongContext           install_context.InstallGatewayKongContext
	InstallGatewayKongEnterpriseContext install_context.InstallGatewayKongEnterpriseContext
	InstallTracingContext               install_context.InstallTracingContext
	InstallLoggingContext               install_context.InstallLoggingContext
}

RootContext contains variables, functions and components that can be overridden when extending kumactl or running the test. To create one for tests use helper functions in pkg/test/kumactl/context.go Example:

rootCtx := kumactl_cmd.DefaultRootContext() rootCtx.InstallCpContext.Args.ControlPlane_image_tag = "0.0.1" rootCmd := cmd.NewRootCmd(rootCtx) err := rootCmd.Execute()

func DefaultRootContext

func DefaultRootContext() *RootContext

func (*RootContext) BaseAPIServerClient added in v1.8.1

func (rc *RootContext) BaseAPIServerClient() (util_http.Client, error)

func (*RootContext) CheckServerVersionCompatibility added in v1.8.1

func (rc *RootContext) CheckServerVersionCompatibility() error

func (*RootContext) Config

func (rc *RootContext) Config() *config_proto.Configuration

func (*RootContext) CurrentApiClient

func (rc *RootContext) CurrentApiClient() (kumactl_resources.ApiServerClient, error)

func (*RootContext) CurrentContext

func (rc *RootContext) CurrentContext() (*config_proto.Context, error)

func (*RootContext) CurrentControlPlane

func (rc *RootContext) CurrentControlPlane() (*config_proto.ControlPlane, error)

func (*RootContext) CurrentDataplaneInspectClient added in v1.8.1

func (rc *RootContext) CurrentDataplaneInspectClient() (kumactl_resources.DataplaneInspectClient, error)

func (*RootContext) CurrentDataplaneOverviewClient

func (rc *RootContext) CurrentDataplaneOverviewClient() (kumactl_resources.DataplaneOverviewClient, error)

func (*RootContext) CurrentDataplaneTokenClient

func (rc *RootContext) CurrentDataplaneTokenClient() (tokens.DataplaneTokenClient, error)

func (*RootContext) CurrentInspectEnvoyProxyClient added in v1.8.1

func (rc *RootContext) CurrentInspectEnvoyProxyClient(resDesc core_model.ResourceTypeDescriptor) (kumactl_resources.InspectEnvoyProxyClient, error)

func (*RootContext) CurrentMesh

func (rc *RootContext) CurrentMesh() string

func (*RootContext) CurrentMeshGatewayInspectClient added in v1.8.1

func (rc *RootContext) CurrentMeshGatewayInspectClient() (kumactl_resources.MeshGatewayInspectClient, error)

func (*RootContext) CurrentPolicyInspectClient added in v1.8.1

func (rc *RootContext) CurrentPolicyInspectClient() (kumactl_resources.PolicyInspectClient, error)

func (*RootContext) CurrentResourceStore

func (rc *RootContext) CurrentResourceStore() (core_store.ResourceStore, error)

func (*RootContext) CurrentServiceOverviewClient

func (rc *RootContext) CurrentServiceOverviewClient() (kumactl_resources.ServiceOverviewClient, error)

func (*RootContext) CurrentZoneEgressOverviewClient added in v1.8.1

func (rc *RootContext) CurrentZoneEgressOverviewClient() (kumactl_resources.ZoneEgressOverviewClient, error)

func (*RootContext) CurrentZoneIngressOverviewClient

func (rc *RootContext) CurrentZoneIngressOverviewClient() (kumactl_resources.ZoneIngressOverviewClient, error)

func (*RootContext) CurrentZoneIngressTokenClient

func (rc *RootContext) CurrentZoneIngressTokenClient() (tokens.ZoneIngressTokenClient, error)

func (*RootContext) CurrentZoneOverviewClient

func (rc *RootContext) CurrentZoneOverviewClient() (kumactl_resources.ZoneOverviewClient, error)

func (*RootContext) CurrentZoneTokenClient added in v1.8.1

func (rc *RootContext) CurrentZoneTokenClient() (tokens.ZoneTokenClient, error)

func (*RootContext) IsFirstTimeUsage

func (rc *RootContext) IsFirstTimeUsage() bool

func (*RootContext) LoadConfig

func (rc *RootContext) LoadConfig() error

func (*RootContext) LoadInMemoryConfig added in v1.8.1

func (rc *RootContext) LoadInMemoryConfig()

func (*RootContext) Now

func (rc *RootContext) Now() time.Time

func (*RootContext) SaveConfig

func (rc *RootContext) SaveConfig() error

type RootRuntime

type RootRuntime struct {
	Config                       config_proto.Configuration
	Now                          func() time.Time
	AuthnPlugins                 map[string]plugins.AuthnPlugin
	NewBaseAPIServerClient       func(*config_proto.ControlPlaneCoordinates_ApiServer, time.Duration) (util_http.Client, error)
	NewResourceStore             func(util_http.Client) core_store.ResourceStore
	NewDataplaneOverviewClient   func(util_http.Client) kumactl_resources.DataplaneOverviewClient
	NewDataplaneInspectClient    func(util_http.Client) kumactl_resources.DataplaneInspectClient
	NewMeshGatewayInspectClient  func(util_http.Client) kumactl_resources.MeshGatewayInspectClient
	NewInspectEnvoyProxyClient   func(core_model.ResourceTypeDescriptor, util_http.Client) kumactl_resources.InspectEnvoyProxyClient
	NewPolicyInspectClient       func(util_http.Client) kumactl_resources.PolicyInspectClient
	NewZoneIngressOverviewClient func(util_http.Client) kumactl_resources.ZoneIngressOverviewClient
	NewZoneEgressOverviewClient  func(util_http.Client) kumactl_resources.ZoneEgressOverviewClient
	NewZoneOverviewClient        func(util_http.Client) kumactl_resources.ZoneOverviewClient
	NewServiceOverviewClient     func(util_http.Client) kumactl_resources.ServiceOverviewClient
	NewDataplaneTokenClient      func(util_http.Client) tokens.DataplaneTokenClient
	NewZoneIngressTokenClient    func(util_http.Client) tokens.ZoneIngressTokenClient
	NewZoneTokenClient           func(util_http.Client) tokens.ZoneTokenClient
	NewAPIServerClient           func(util_http.Client) kumactl_resources.ApiServerClient
	Registry                     registry.TypeRegistry
}

type RunnableWrapper

type RunnableWrapper = func(func(*cobra.Command, []string) error) func(*cobra.Command, []string) error

Jump to

Keyboard shortcuts

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