Documentation ¶
Overview ¶
Package session wraps ocm session parameters to be accessed during cli commands. For example both the active connection and logger can be retrieved from the current session.
Index ¶
- Constants
- Variables
- func LogLevel(verbosity int) log.Level
- func ParseOrder(maybeOrder string) ocm.Order
- func ParseTime(maybeTime string) (time.Time, error)
- func PromptYesOrNo(out io.Writer, in io.Reader, msg string) bool
- type CommonOptions
- type Config
- type FilterOptions
- func (f *FilterOptions) AddAfterFlag(flags *pflag.FlagSet)
- func (f *FilterOptions) AddBeforeFlag(flags *pflag.FlagSet)
- func (f *FilterOptions) AddOrderFlag(flags *pflag.FlagSet)
- func (f *FilterOptions) AfterUsage(usg string)
- func (f *FilterOptions) BeforeUsage(usg string)
- func (f *FilterOptions) OrderDefault(ord string)
- func (f *FilterOptions) OrderUsage(usg string)
- func (f *FilterOptions) ParseFilterOptions() error
- type SearchOptions
- type Session
Constants ¶
const ( LogLevelError = iota LogLevelWarn LogLevelInfo LogLevelDebug )
Variables ¶
var ErrNoConfigurationLoaded = errors.New("no configuration loaded")
Functions ¶
func ParseOrder ¶
Types ¶
type CommonOptions ¶
func (*CommonOptions) AddColumnsFlag ¶
func (c *CommonOptions) AddColumnsFlag(flags *pflag.FlagSet)
func (*CommonOptions) AddNoColorFlag ¶ added in v0.2.2
func (c *CommonOptions) AddNoColorFlag(flags *pflag.FlagSet)
func (*CommonOptions) AddNoHeadersFlag ¶
func (c *CommonOptions) AddNoHeadersFlag(flags *pflag.FlagSet)
func (*CommonOptions) DefaultColumns ¶
func (c *CommonOptions) DefaultColumns(cols string)
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config wraps an 'ocm-cli' config object and it's fields/methods.
func LoadConfig ¶
LoadConfig loads an existing 'ocm.json' file and returns a Config object if possible.
func (Config) IsEmpty ¶
IsEmpty returns true if there is no configuration file or if no credentials are present with which to start a session.
type FilterOptions ¶
type FilterOptions struct { Order ocm.Order Before time.Time After time.Time // contains filtered or unexported fields }
func (*FilterOptions) AddAfterFlag ¶
func (f *FilterOptions) AddAfterFlag(flags *pflag.FlagSet)
func (*FilterOptions) AddBeforeFlag ¶
func (f *FilterOptions) AddBeforeFlag(flags *pflag.FlagSet)
func (*FilterOptions) AddOrderFlag ¶
func (f *FilterOptions) AddOrderFlag(flags *pflag.FlagSet)
func (*FilterOptions) AfterUsage ¶
func (f *FilterOptions) AfterUsage(usg string)
func (*FilterOptions) BeforeUsage ¶
func (f *FilterOptions) BeforeUsage(usg string)
func (*FilterOptions) OrderDefault ¶
func (f *FilterOptions) OrderDefault(ord string)
func (*FilterOptions) OrderUsage ¶
func (f *FilterOptions) OrderUsage(usg string)
func (*FilterOptions) ParseFilterOptions ¶
func (f *FilterOptions) ParseFilterOptions() error
type SearchOptions ¶
type SearchOptions struct { Search string // contains filtered or unexported fields }
func (*SearchOptions) AddSearchFlag ¶
func (s *SearchOptions) AddSearchFlag(flags *pflag.FlagSet)
func (*SearchOptions) SearchUsage ¶
func (s *SearchOptions) SearchUsage(usg string)
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session provides access to the session-bound parameters for an invocation of this plug-in.
func NewSession ¶
NewSession loads an ocm configuration created after the user runs 'ocm login' and starts a connection to ocm. A logger with session context is also made available to callers of NewSession. An error is returned if a configuration cannot be loaded or if a connection cannot be made to OCM. Otherwise a pointer to a session object is returned.
func (*Session) Conn ¶
func (s *Session) Conn() *sdk.Connection
Conn returns the OCM connection for the current session.
func (*Session) End ¶
func (s *Session) End()
End releases any open session resources and logs any errors that may occur during this process.