Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigContextGen(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions, ...) error
- func ConfigContextGetCurrent(cfgOpts *opts.ConfigOptions) error
- func ConfigContextList(cfgOpts *opts.ConfigOptions) error
- func ConfigContextShow(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
- func ConfigContextTest(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
- func ConfigContextUse(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
- func ConfigGenDefaultConfig(cfgOpts *opts.ConfigOptions) (err error)
- func ConfigShow(cfgOpts *opts.ConfigOptions) error
- func ConfigTest(cfgOpts *opts.ConfigOptions) error
- func GenClient(c *opts.ConfigOptions) (client *elastic7.Client, err error)
- func GenESConfig(cfg Config, ctx string, debug bool) (es7cfg elastic7.Config, err error)
- func ToBytes(file string) (b []byte, err error)
- type Cluster
- type Config
- type ConfigCmd
- type Context
- type Contexts
- type Token
- type User
- type Users
Constants ¶
View Source
const ( // Default configuration file name DefaultElasticConfigName string = "config" // Default configuration file path DefaultElasticFolderPath string = "$HOME/.elastic" // Default full path to configuration file DefaultElasticConfig string = "$HOME/.elastic/config" // Default configuration folder mode DefaultElasticFolderMode uint32 = 755 // Default configuration file mode DefaultElasticConfigMode uint32 = 0600 )
Variables ¶
View Source
var DefaultConfig = Config{ Clusters: []Cluster{ Cluster{ Name: "local", ElasticAddresses: []string{ "http://localhost:9200", "http://127.0.0.1:9200", }, AllowSelfSigned: "yes", }, }, Contexts: []Contexts{ Contexts{ Name: "local", Context: Context{ Cluster: "local", User: "elastic", }, }, Contexts{ Name: "elastic@local", Context: Context{ Cluster: "local", User: "elastic@local", }, }, }, Users: []Users{ Users{ Name: "elastic@local", User: User{ Name: "elastic", Password: "", ApiKey: "", Token: Token{ Value: "", Expiration: "", }, }, }, Users{ Name: "elastic", User: User{ Name: "elastic", Password: "changeme", ApiKey: "", Token: Token{ Value: "", Expiration: "", }, }, }, }, CurrentContext: "local", }
Default Config struct used in GenDefaultConfig. Connects to a local elasticsearch cluster
Functions ¶
func ConfigContextGen ¶ added in v0.1.4
func ConfigContextGen(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions, credOpts *opts.CredentialOptions) error
func ConfigContextGetCurrent ¶ added in v0.1.4
func ConfigContextGetCurrent(cfgOpts *opts.ConfigOptions) error
func ConfigContextList ¶ added in v0.1.4
func ConfigContextList(cfgOpts *opts.ConfigOptions) error
func ConfigContextShow ¶ added in v0.1.4
func ConfigContextShow(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
func ConfigContextTest ¶ added in v0.1.4
func ConfigContextTest(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
func ConfigContextUse ¶ added in v0.1.4
func ConfigContextUse(cfgOpts *opts.ConfigOptions, cmdOpts *opts.CommandOptions) error
Change the value of Config.CurrentContext
func ConfigGenDefaultConfig ¶ added in v0.1.4
func ConfigGenDefaultConfig(cfgOpts *opts.ConfigOptions) (err error)
Generate a configuration file for connecting to a local elasticsearch cluster if a file is not found by path
func ConfigShow ¶ added in v0.1.4
func ConfigShow(cfgOpts *opts.ConfigOptions) error
Marshal a Config into bytes
func ConfigTest ¶ added in v0.1.4
func ConfigTest(cfgOpts *opts.ConfigOptions) error
func GenClient ¶ added in v0.1.4
func GenClient(c *opts.ConfigOptions) (client *elastic7.Client, err error)
func GenESConfig ¶
Types ¶
type Cluster ¶
type Cluster struct { Name string `yaml:"name"` ElasticAddresses []string `yaml:"elastic-addresses,omitempty"` //KibanaAddresses []string `yaml:"kibana-addresses",omitempty` CloudID string `yaml:"cloud-id,omitempty"` AllowSelfSigned string `yaml:"allowSelfSigned,omitempty"` }
Connection details for a cluster
type Config ¶
type Config struct { Clusters []Cluster `yaml:"clusters"` Contexts []Contexts `yaml:"contexts"` Users []Users `yaml:"users"` CurrentContext string `yaml:"current-context,omitempty"` }
File configuration
func NewConfig ¶ added in v0.1.4
func NewConfig(baseContext string, fullContext string, configUsername string, cfgOpts *opts.ConfigOptions, credOpts *opts.CredentialOptions) (Config, error)
func ReadConfig ¶
Unmarshal bytes into a Config
type ConfigCmd ¶ added in v0.0.4
type Context ¶
type Context struct { Cluster string `yaml:"cluster,omitempty"` User string `yaml:"user,omitempty"` }
A combination of a named Cluster and named User. Used for lookups of the respective objects
type Contexts ¶
type Contexts struct { Name string `yaml:"name,omitempty"` Context Context `yaml:"context,omitempty"` }
Named Context
type Token ¶
type Token struct { Value string `yaml:"value,omitempty"` Expiration string `yaml:"expiration,omitempty"` }
Token used for authentication
type User ¶
type User struct { Name string `yaml:"name,omitempty"` NameCmd ConfigCmd `yaml:"name-cmd,omitempty"` Password string `yaml:"password,omitempty"` PasswordCmd ConfigCmd `yaml:"password-cmd,omitempty"` ApiKey string `yaml:"api-key,omitempty"` Token Token `yaml:"token,omitempty"` }
Authentication credentials
Click to show internal directories.
Click to hide internal directories.