pkg

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewESClientFromParsedLayers added in v0.0.6

func NewESClientFromParsedLayers(
	parsedLayers map[string]*layers.ParsedParameterLayer,
) (*elasticsearch.Client, error)

Types

type ESClientFactory added in v0.0.5

type ESClientFactory func(map[string]*layers.ParsedParameterLayer) (*elasticsearch.Client, error)

type ElasticSearchCommand

type ElasticSearchCommand struct {
	Query string
	// contains filtered or unexported fields
}

func NewElasticSearchCommand

func NewElasticSearchCommand(
	description *cmds.CommandDescription,
	clientFactory ESClientFactory,
	query string,
) (*ElasticSearchCommand, error)

func (*ElasticSearchCommand) Description

func (esc *ElasticSearchCommand) Description() *cmds.CommandDescription

func (*ElasticSearchCommand) RenderQuery added in v0.0.3

func (esc *ElasticSearchCommand) RenderQuery(parameters map[string]interface{}) (string, error)

func (*ElasticSearchCommand) RenderQueryToJSON added in v0.0.3

func (esc *ElasticSearchCommand) RenderQueryToJSON(parameters map[string]interface{}) (string, error)

func (*ElasticSearchCommand) Run

func (esc *ElasticSearchCommand) Run(
	ctx context.Context,
	parsedLayers map[string]*layers.ParsedParameterLayer,
	ps map[string]interface{},
	gp *cmds.GlazeProcessor,
) error

func (*ElasticSearchCommand) RunQueryIntoGlaze added in v0.0.3

func (esc *ElasticSearchCommand) RunQueryIntoGlaze(
	ctx context.Context,
	es *elasticsearch.Client,
	parameters map[string]interface{},
	gp *cmds.GlazeProcessor,
) error

type ElasticSearchCommandLoader added in v0.0.3

type ElasticSearchCommandLoader struct {
	// contains filtered or unexported fields
}

ElasticSearchCommandLoader walks through a directory and finds all directories that end with .escuse-me and loads the commands from there. The layout of an .escuse-me directory is as follows: - main.yaml (mandatory) contains the command description

  • contains flags, arguments, name, short
  • reference the query template file

- the alias folder, which contains alias definitions in single yaml files - the data folder, which contains additional data in json / csv / yaml format

  • this data is passed to the template at evaluation file, and can be used to store things like tags and constant strings, boost values and the like

func NewElasticSearchCommandLoader added in v0.0.5

func NewElasticSearchCommandLoader(clientFactory ESClientFactory) *ElasticSearchCommandLoader

func (*ElasticSearchCommandLoader) LoadCommandAliasFromYAML added in v0.0.3

func (escl *ElasticSearchCommandLoader) LoadCommandAliasFromYAML(s io.Reader) ([]*cmds.CommandAlias, error)

func (*ElasticSearchCommandLoader) LoadCommandFromDir added in v0.0.3

func (escl *ElasticSearchCommandLoader) LoadCommandFromDir(
	f fs.FS,
	dir string,
) ([]cmds.Command, []*cmds.CommandAlias, error)

func (*ElasticSearchCommandLoader) LoadCommandsFromFS added in v0.0.3

func (l *ElasticSearchCommandLoader) LoadCommandsFromFS(
	f fs.FS,
	dir string,
) ([]cmds.Command, []*cmds.CommandAlias, error)

type EsClientSettings added in v0.0.6

type EsClientSettings struct {
	Addresses               []string `glazed.parameter:"addresses"`
	Username                string   `glazed.parameter:"username"`
	Password                string   `glazed.parameter:"password"`
	CloudId                 string   `glazed.parameter:"cloud-id"`
	ApiKey                  string   `glazed.parameter:"api-key"`
	ServiceToken            string   `glazed.parameter:"service-token"`
	CertificateFingerprint  string   `glazed.parameter:"certificate-fingerprint"`
	RetryOnStatus           []int    `glazed.parameter:"retry-on-status"`
	DisableRetry            bool     `glazed.parameter:"disable-retry"`
	MaxRetries              int      `glazed.parameter:"max-retries"`
	EnableMetrics           bool     `glazed.parameter:"enable-metrics"`
	EnableDebugLogger       bool     `glazed.parameter:"enable-debug-logger"`
	EnableCompatibilityMode bool     `glazed.parameter:"enable-compatibility-mode"`
}

func NewESClientSettingsFromParsedLayers added in v0.0.6

func NewESClientSettingsFromParsedLayers(parsedLayers map[string]*layers.ParsedParameterLayer) (*EsClientSettings, error)

type EsParameterLayer added in v0.0.5

type EsParameterLayer struct {
	*layers.ParameterLayerImpl
}

func NewESParameterLayer added in v0.0.5

func NewESParameterLayer(options ...layers.ParameterLayerOptions) (*EsParameterLayer, error)

func (*EsParameterLayer) ParseFlagsFromCobraCommand added in v0.0.6

func (ep *EsParameterLayer) ParseFlagsFromCobraCommand(
	cmd *cobra.Command,
) (map[string]interface{}, error)

type EscuseMeCommandDescription

type EscuseMeCommandDescription struct {
	Name      string                            `yaml:"name"`
	Short     string                            `yaml:"short"`
	Long      string                            `yaml:"long,omitempty"`
	Flags     []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
	Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`

	QueryTemplate string `yaml:"queryTemplate,omitempty"`
}

type QueriesCommand added in v0.0.5

type QueriesCommand struct {
	// contains filtered or unexported fields
}

func NewQueriesCommand added in v0.0.5

func NewQueriesCommand(
	allQueries []*ElasticSearchCommand,
	aliases []*glazed_cmds.CommandAlias,
	options ...glazed_cmds.CommandDescriptionOption,
) (*QueriesCommand, error)

func (*QueriesCommand) Description added in v0.0.5

func (q *QueriesCommand) Description() *glazed_cmds.CommandDescription

func (*QueriesCommand) Run added in v0.0.5

func (q *QueriesCommand) Run(
	ctx context.Context,
	parsedLayers map[string]*layers.ParsedParameterLayer,
	ps map[string]interface{},
	gp *glazed_cmds.GlazeProcessor,
) error

Jump to

Keyboard shortcuts

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