Documentation
¶
Index ¶
- func Connect(server string, mods ...GwcOrGrpcOptions) (grpc.ClientConnInterface, error)
- func NiceError(err error, formatting string, args ...interface{}) error
- func SetCookieStreamInterceptor(cookie *http.Cookie) grpc.StreamClientInterceptor
- func SetCookieUnaryInterceptor(cookie *http.Cookie) grpc.UnaryClientInterceptor
- type AuthFlags
- type BaseFlags
- func (bf *BaseFlags) Context() *ccontext.Context
- func (bf *BaseFlags) IdentityCookie() (string, *http.Cookie, error)
- func (bf *BaseFlags) IdentityErrorHandler(message string) kflags.ErrorHandler
- func (bf *BaseFlags) IdentityStore() (identity.IdentityStore, error)
- func (bf *BaseFlags) IdentityToken() (string, string, error)
- func (bf *BaseFlags) Init() error
- func (bf *BaseFlags) LoadFlagAssets(populator kflags.Populator, assets map[string][]byte)
- func (bf *BaseFlags) Register(set kflags.FlagSet, prefix string) *BaseFlags
- func (bf *BaseFlags) Run(set kflags.FlagSet, populator kflags.Populator, run kflags.Runner)
- func (bf *BaseFlags) UpdateFlagDefaults(populator kflags.Populator, domain string) error
- type GwcOrGrpcOption
- type GwcOrGrpcOptions
- type ServerFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(server string, mods ...GwcOrGrpcOptions) (grpc.ClientConnInterface, error)
func SetCookieStreamInterceptor ¶
func SetCookieStreamInterceptor(cookie *http.Cookie) grpc.StreamClientInterceptor
func SetCookieUnaryInterceptor ¶
func SetCookieUnaryInterceptor(cookie *http.Cookie) grpc.UnaryClientInterceptor
Types ¶
type AuthFlags ¶
type AuthFlags struct { // The identity to use. *identity.IdentityFlags // Flags indicating how to connect to the authentication server. *ServerFlags }
func DefaultAuthFlags ¶
func DefaultAuthFlags() *AuthFlags
type BaseFlags ¶
type BaseFlags struct { *klog.Flags *AuthFlags *cache.Local *provider.ProviderFlags // Function capable of opening the config stores. // This is not controlled by command line, but useful for tests or // other libraries consuming BaseFlags. ConfigOpener config.Opener // The name used to build the paths to find config files or cached files. // For example, if ConfigName is "enkit", config files may be stored in "~/.config/enkit". // This name can be shared across multiple CLI tools needing the same configs. ConfigName string // The prefix to prepend to authentication cookies. // This is only useful if you have multiple organizations using different instance of enkit tools. CookiePrefix string // The name of the command, used in help strings and to load config customizations specific to the command. CommandName string // Avoid displaying progress bars. NoProgress bool // Allow to override the security token used, and identity. OverrideToken string OverrideIdentity string // Logger object. Guaranteed to never be nil, and always be usable. Log *logger.Proxy }
func DefaultBaseFlags ¶
func (*BaseFlags) IdentityCookie ¶
func (*BaseFlags) IdentityErrorHandler ¶
func (bf *BaseFlags) IdentityErrorHandler(message string) kflags.ErrorHandler
Use with kcobra.Run or similar functions to decoarete an IdentityError with the proper error message to guide the user through authentication.
For example, use kcobra.Run(..., WithErrorHandler(
HandleIdentityError("run enkit login to log in")
to make sure the user is told to use enkit login in case of identity related errors.
func (*BaseFlags) IdentityStore ¶
func (bf *BaseFlags) IdentityStore() (identity.IdentityStore, error)
func (*BaseFlags) Init ¶
Initializes a BaseFlags object after all flags have been parsed.
Invoked automatically by Run once defaults are loaded. Must be invoked every time base flags change value, to refresh the corresponding objects.
func (*BaseFlags) LoadFlagAssets ¶
type GwcOrGrpcOption ¶
type GwcOrGrpcOption interface{}
type GwcOrGrpcOptions ¶
type GwcOrGrpcOptions []GwcOrGrpcOption
func WithCookie ¶
func WithCookie(cookie *http.Cookie) GwcOrGrpcOptions
func WithInsecure ¶
func WithInsecure() GwcOrGrpcOptions
type ServerFlags ¶
func DefaultServerFlags ¶
func DefaultServerFlags(name, description, address string) *ServerFlags
DefaultServerFlags initializes and returns a ServerFlags object with defaults.
name is a string to prepend to the registered flags. For example, an "auth" prefix will result in the flags --auth-server and --auth-allow-insecure to be registerd. This allows to have multiple servers defined by flags in the same binary.
description is a description for the server, which will be used to create the help messages. For example, a name of "Authentication server" will be appended to "allow... connections to the... Authentication server".
address is the default address of the server to connect to, leave it empty if unknown.
func (*ServerFlags) Connect ¶
func (sf *ServerFlags) Connect(mods ...GwcOrGrpcOptions) (grpc.ClientConnInterface, error)