Documentation
¶
Index ¶
- Constants
- Variables
- func AddCommonConfigItems(cs config.ConfigurationSet) error
- func AddCommonUseConfigItems(cs config.ConfigurationSet) error
- func AddHistoryConfigItems(cs config.ConfigurationSet) error
- func AddHistoryExportConfig(cs config.ConfigurationSet) error
- func AddHistoryIdentifierConfig(cs config.ConfigurationSet) error
- func AddHistoryImportConfig(cs config.ConfigurationSet) error
- func AddHistoryLocationItems(cs config.ConfigurationSet) error
- func AddHistoryQueryConfig(cs config.ConfigurationSet) error
- func AddHistoryRemoveConfig(cs config.ConfigurationSet) error
- func AddKubeconfigConfigItems(cs config.ConfigurationSet) error
- func DefaultSelectCluster(discoverOutput *discovery.DiscoverOutput) (*discovery.Cluster, error)
- type AliasAddInput
- type AliasListInput
- type AliasRemoveInput
- type App
- func (a *App) AliasAdd(ctx context.Context, input *AliasAddInput) error
- func (a *App) AliasList(ctx context.Context, input *AliasListInput) error
- func (a *App) AliasRemove(ctx context.Context, input *AliasRemoveInput) error
- func (a *App) Configuration(ctx context.Context, input *ConfigureInput) error
- func (a *App) ConnectTo(ctx context.Context, params *ConnectToInput) error
- func (a *App) HistoryExport(ctx context.Context, input *HistoryExportInput) error
- func (a *App) HistoryImport(ctx context.Context, input *HistoryImportInput) error
- func (a *App) HistoryRemove(ctx context.Context, input *HistoryRemoveInput) error
- func (a *App) Logout(ctx context.Context, params *LogoutInput) error
- func (a *App) QueryHistory(ctx context.Context, input *HistoryQueryInput) error
- func (a *App) SetNonInteractive()
- func (a *App) Use(ctx context.Context, input *UseInput) error
- type CommonConfig
- type CommonUseConfig
- type ConfigureInput
- type ConnectToInput
- type HistoryConfig
- type HistoryExportConfig
- type HistoryExportInput
- type HistoryIdentifierConfig
- type HistoryImportConfig
- type HistoryImportInput
- type HistoryLocationConfig
- type HistoryQueryConfig
- type HistoryQueryInput
- type HistoryRemoveConfig
- type HistoryRemoveInput
- type KubernetesConfig
- type LogoutInput
- type Option
- func WithHTTPClient(client khttp.Client) Option
- func WithHistoryStore(store history.Store) Option
- func WithInteractive(interactive bool) Option
- func WithItemSelectorFunc(itemSelector provider.SelectItemFunc) Option
- func WithLogger(logger *zap.SugaredLogger) Option
- func WithSelectClusterFn(fn SelectClusterFunc) Option
- func WithSelectClusterFunc(selectFunc SelectClusterFunc) Option
- type SelectClusterFunc
- type UseInput
Constants ¶
const ( NoInputConfigItem = "no-input" NonInteractiveConfigItem = "non-interactive" NoVersionCheckConfigItem = "no-version-check" ConfigPathConfigItem = "config" )
const (
// Name is the name of the application
Name = "kconnect"
)
Variables ¶
var ( ErrUnknownConfigItemType = errors.New("unknown item type") ErrClusterNotFound = errors.New("cluster not found") ErrAliasAlreadyUsed = errors.New("alias already in use") ErrSourceLocationRequired = errors.New("source location is required for importing") ErrHistoryLocationRequired = errors.New("history location is required") ErrHistoryIDRequired = errors.New("history id is required") ErrAliasRequired = errors.New("alias is required") ErrAliasAndIDNotAllowed = errors.New("alias and id bith specified, only 1 is allowed") ErrAliasNotFound = errors.New("no alias found") ErrNoEntriesFound = errors.New("no entries found") ErrUnknownProvider = errors.New("unknown provider") ErrDiscoveryProviderRequired = errors.New("discovery provider required") ErrIdentityProviderRequired = errors.New("identity provider required") ErrUnsuportedIdpProtocol = errors.New("unsupported idp protocol") )
var ErrNotOKHTTPStatusCode = errors.New("non 200 status code")
Functions ¶
func AddCommonConfigItems ¶
func AddCommonConfigItems(cs config.ConfigurationSet) error
func AddCommonUseConfigItems ¶
func AddCommonUseConfigItems(cs config.ConfigurationSet) error
func AddHistoryConfigItems ¶
func AddHistoryConfigItems(cs config.ConfigurationSet) error
func AddHistoryExportConfig ¶
func AddHistoryExportConfig(cs config.ConfigurationSet) error
func AddHistoryIdentifierConfig ¶
func AddHistoryIdentifierConfig(cs config.ConfigurationSet) error
func AddHistoryImportConfig ¶
func AddHistoryImportConfig(cs config.ConfigurationSet) error
func AddHistoryLocationItems ¶
func AddHistoryLocationItems(cs config.ConfigurationSet) error
func AddHistoryQueryConfig ¶
func AddHistoryQueryConfig(cs config.ConfigurationSet) error
func AddHistoryRemoveConfig ¶
func AddHistoryRemoveConfig(cs config.ConfigurationSet) error
func AddKubeconfigConfigItems ¶
func AddKubeconfigConfigItems(cs config.ConfigurationSet) error
AddKubeconfigConfigItems will add the kubeconfig related config items
func DefaultSelectCluster ¶
func DefaultSelectCluster(discoverOutput *discovery.DiscoverOutput) (*discovery.Cluster, error)
DefaultSelectCluster is the default cluster selection function. If there is only 1 cluster then it automatically selects it. If there are more than 1 cluster then a selection is displayed and the user must choose one
Types ¶
type AliasAddInput ¶
type AliasAddInput struct { CommonConfig HistoryLocationConfig HistoryIdentifierConfig }
AliasAddInput defines the inputs for AliasAdd
type AliasListInput ¶
type AliasListInput struct { CommonConfig HistoryLocationConfig Output *printer.OutputPrinter `json:"output,omitempty"` }
AliasListInput defines the inputs for AliasList
type AliasRemoveInput ¶
type AliasRemoveInput struct { CommonConfig HistoryLocationConfig HistoryIdentifierConfig All bool `json:"all"` }
AliasRemoveInput defines the inputs for AliasRemove
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the kconnect application and contains the implementation of the apps logic
func (*App) AliasAdd ¶
func (a *App) AliasAdd(ctx context.Context, input *AliasAddInput) error
AliasAdd will add an alias to an existing history entry
func (*App) AliasList ¶
func (a *App) AliasList(ctx context.Context, input *AliasListInput) error
AliasList implements the alias listing functionality
func (*App) AliasRemove ¶
func (a *App) AliasRemove(ctx context.Context, input *AliasRemoveInput) error
AliasRemove will remove an alias from history entries. You can also remove all aliases.
func (*App) Configuration ¶
func (a *App) Configuration(ctx context.Context, input *ConfigureInput) error
Configuration implements the configure command
func (*App) HistoryExport ¶
func (a *App) HistoryExport(ctx context.Context, input *HistoryExportInput) error
AliasList implements the alias listing functionality
func (*App) HistoryImport ¶
func (a *App) HistoryImport(ctx context.Context, input *HistoryImportInput) error
AliasList implements the alias listing functionality
func (*App) HistoryRemove ¶
func (a *App) HistoryRemove(ctx context.Context, input *HistoryRemoveInput) error
func (*App) QueryHistory ¶
func (a *App) QueryHistory(ctx context.Context, input *HistoryQueryInput) error
func (*App) SetNonInteractive ¶
func (a *App) SetNonInteractive()
type CommonConfig ¶
type CommonUseConfig ¶
type CommonUseConfig struct {
Namespace string `json:"namespace,omitempty"`
}
type ConfigureInput ¶
type ConfigureInput struct { SourceLocation *string `json:"file,omitempty"` Output *printer.OutputPrinter `json:"output,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` }
ConfigureInput is the input type for the configure command
type ConnectToInput ¶
type ConnectToInput struct { CommonConfig HistoryConfig KubernetesConfig AliasOrIDORPosition string Password string `json:"password"` SetCurrent bool `json:"set-current,omitempty"` }
type HistoryConfig ¶
type HistoryConfig struct { HistoryLocationConfig MaxItems int `json:"max-history"` NoHistory bool `json:"no-history"` EntryID string `json:"entry-id"` }
type HistoryExportConfig ¶
type HistoryExportInput ¶
type HistoryExportInput struct { CommonConfig HistoryLocationConfig HistoryExportConfig }
type HistoryIdentifierConfig ¶
type HistoryImportConfig ¶
type HistoryImportInput ¶
type HistoryImportInput struct { CommonConfig HistoryLocationConfig HistoryImportConfig }
type HistoryLocationConfig ¶
type HistoryLocationConfig struct {
Location string `json:"history-location"`
}
type HistoryQueryConfig ¶
type HistoryQueryConfig struct { Filter string `json:"filter,omitempty"` Output *printer.OutputPrinter `json:"output,omitempty"` }
type HistoryQueryInput ¶
type HistoryQueryInput struct { HistoryConfig KubernetesConfig HistoryQueryConfig ClusterProvider *string `json:"cluster-provider,omitempty"` IdentityProvider *string `json:"identity-provider,omitempty"` ProviderID *string `json:"provider-id,omitempty"` HistoryID *string `json:"id,omitempty"` Alias *string `json:"alias,omitempty"` Flags map[string]string `json:"flags,omitempty"` Output *printer.OutputPrinter `json:"output,omitempty"` }
type HistoryRemoveConfig ¶
type HistoryRemoveInput ¶
type HistoryRemoveInput struct { CommonConfig HistoryLocationConfig HistoryRemoveConfig RemoveList []string }
type KubernetesConfig ¶
type KubernetesConfig struct {
Kubeconfig string `json:"kubeconfig"`
}
type LogoutInput ¶
type LogoutInput struct { CommonConfig HistoryConfig KubernetesConfig All bool Alias string IDs string }
type Option ¶
type Option func(*App)
Option represents an option to use with the kcinnect application
func WithHTTPClient ¶
func WithHistoryStore ¶
func WithInteractive ¶
func WithItemSelectorFunc ¶
func WithItemSelectorFunc(itemSelector provider.SelectItemFunc) Option
func WithLogger ¶
func WithLogger(logger *zap.SugaredLogger) Option
func WithSelectClusterFn ¶
func WithSelectClusterFn(fn SelectClusterFunc) Option
WithSelectClusterFn is an option to allow using a custom select cluster function
func WithSelectClusterFunc ¶
func WithSelectClusterFunc(selectFunc SelectClusterFunc) Option
type SelectClusterFunc ¶
type SelectClusterFunc func(discoverOutput *discovery.DiscoverOutput) (*discovery.Cluster, error)
SelectClusterFunc is a function type that is used to allow selection of a cluster
type UseInput ¶
type UseInput struct { CommonConfig CommonUseConfig HistoryConfig KubernetesConfig common.IdentityProviderConfig common.ClusterProviderConfig SetCurrent bool `json:"set-current,omitempty"` DiscoveryProvider string IdentityProvider string IgnoreAlias bool ConfigSet config.ConfigurationSet }
UseInput are the parameters to the use function