options

package
v0.0.0-...-e830f39 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLI struct {
	Debug     bool         `help:"Enable debug mode."`
	Configure ConfigureCmd `cmd help:"Init ES server configs"`
	List      ListCmd      `cmd help:"Show the current server configs"`
	Search    SearchCmd    `cmd help:"Search for data"`
	Use       UseCmd       `cmd help:"Switch between configured server/role"`
}

CLI represents possible CLI options.

Functions

This section is empty.

Types

type ConfigureCmd

type ConfigureCmd struct {
	Server bool `optional help:"Add a new server definition"`
	Role   bool `optional help:"Add a new role definition"`
	Reset  bool `optional help:"Reset the whole configuration"`
}

ConfigureCmd represents CLI arguments for configure option.

func (*ConfigureCmd) Run

func (c *ConfigureCmd) Run(ctx *Context) error

Run the configure option. It can configure both server and role definitions. Saves each definition in the config file.

type Context

type Context struct {
	Debug         bool
	Configuration config.Configuration
}

Context configuration.

type ListCmd

type ListCmd struct {
}

ListCmd represents CLI arguments for list option.

func (*ListCmd) Run

func (l *ListCmd) Run(ctx *Context) error

Run the list option. Lists the whole config file in a pretty printed style.

type Option

type Option struct {
	Context    *kong.Context
	ConfigFile config.Configuration
}

Option represents a common configuration for all options.

func Parse

func Parse() Option

Parse the CLI arguments.

func (*Option) Run

func (o *Option) Run()

Run the option found through CLI arguments.

type ResponseData

type ResponseData struct {
	Payload map[string]interface{}
}

ResponseData represents the response payload.

type SearchCmd

type SearchCmd struct {
	Query  string `optional help:"Text input to query data. Use the same format as you would use in Kibana"`
	Older  string `` /* 155-byte string literal not displayed */
	Newer  string `` /* 146-byte string literal not displayed */
	Limit  int32  `optional default:"50" help:"Limit the number of messages fetched"`
	Server string `optional help:"Which server to query against. Used to override the current server config"`
	// contains filtered or unexported fields
}

SearchCmd represents CLI arguments for search option.

func (*SearchCmd) AfterApply

func (s *SearchCmd) AfterApply(h *utils.DefaultHTTPClient) error

AfterApply defines the http client instance to used once search option is identified to take execution.

func (*SearchCmd) NewerAsTimestamp

func (s *SearchCmd) NewerAsTimestamp() (int64, error)

NewerAsTimestamp converts a ISO-8601 period as string in timestamp.

func (*SearchCmd) OlderAsTimestamp

func (s *SearchCmd) OlderAsTimestamp() (int64, error)

OlderAsTimestamp converts a ISO-8601 period as string in timestamp.

func (*SearchCmd) Run

func (s *SearchCmd) Run(ctx *Context) error

Run the search option. Queries ES server for data. Prints the results in the stdout.

type SearchParams

type SearchParams struct {
	Index        string
	Size         int32
	WindowFilter string
	Zone         string
	Clause       string
	Older        int64
	Newer        int64
}

SearchParams represents attributes used to query for data.

type UseCmd

type UseCmd struct {
	Server string `optional help:"Set what server to use when querying ES"`
	Role   string `optional help:"Set what role to use when querying ES"`
}

UseCmd represents CLI arguments for use option.

func (*UseCmd) Run

func (u *UseCmd) Run(ctx *Context) error

Run the use option. Use option defines which must be the default option for server and role definitions. Every time kishell runs it uses these definitions to query for data like which server to make requests and which index and time window configuration to use.

Jump to

Keyboard shortcuts

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