client

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package client is the kcl client, containing global options and a kgo.Client builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Strnorm added in v0.2.0

func Strnorm(s string) string

func Wizard added in v0.3.0

func Wizard(noHelp bool)

Wizard walks through an interactive prompt to create a configuration.

Types

type Cfg

type Cfg struct {
	SeedBrokers []string `toml:"seed_brokers,omitempty"`

	TimeoutMillis int32 `toml:"timeout_ms,omitempty"`

	TLS  *CfgTLS  `toml:"tls,omitzero"`
	SASL *CfgSASL `toml:"sasl,omitempty"`
}

cfg contains kcl options that can be defined in a file.

type CfgSASL

type CfgSASL struct {
	Method  string `toml:"method,omitempty"`
	Zid     string `toml:"zid,omitempty"`
	User    string `toml:"user,omitempty"`
	Pass    string `toml:"pass,omitempty"`
	IsToken bool   `toml:"is_token,omitempty"`
}

type CfgTLS

type CfgTLS struct {
	CACert         string `toml:"ca_cert_path,omitempty"`
	ClientCertPath string `toml:"client_cert_path,omitempty"`
	ClientKeyPath  string `toml:"client_key_path,omitempty"`
	ServerName     string `toml:"server_name,omitempty"`

	InsecureSkipVerify bool `toml:"insecure,omitempty"`

	MinVersion       string   `toml:"min_version,omitempty"`
	CipherSuites     []string `toml:"cipher_suites"`
	CurvePreferences []string `toml:"curve_preferences"`
}

type Client

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

Client contains kgo client options and a kgo client.

func New

func New(root *cobra.Command) *Client

New returns a new Client with the given config and installs some persistent flags and commands to root.

func (*Client) AddOpt

func (c *Client) AddOpt(opt kgo.Opt)

AddOpt adds an option to be passed to the eventual new kgo.Client.

func (*Client) AsJSON

func (c *Client) AsJSON() bool

AsJSON returns whether the output should be dumped as JSON if applicable.

func (*Client) Client

func (c *Client) Client() *kgo.Client

Client returns a new kgo.Client using all buffered options.

This can only be used once.

func (*Client) DefaultCfgPath

func (c *Client) DefaultCfgPath() string

DefaultCfgPath returns the default path that is used to load configs.

func (*Client) DiskCfg

func (c *Client) DiskCfg() Cfg

DiskCfg returns the loaded disk configuration.

func (*Client) GroupTransactSession added in v0.4.0

func (c *Client) GroupTransactSession() *kgo.GroupTransactSession

GroupTransactSession returns a new kgo.GroupTransactSession using all buffered options.

This can only be used once, and is incompatible with the Client function.

func (*Client) RemakeWithOpts added in v0.1.1

func (c *Client) RemakeWithOpts(opts ...kgo.Opt) *kgo.Client

RemakeWithOpts remakes the client with additional opts added. The opts are not persisted to the overall Client opts, but the created client does persist. This is not concurrent safe.

func (*Client) TimeoutMillis

func (c *Client) TimeoutMillis() int32

TimeoutMillis is what requests that have timeouts should use.

type Requestor

type Requestor interface {
	Request(context.Context, kmsg.Request) (kmsg.Response, error)
}

Requestor can either be a kgo.Client or kgo.Broker.

Jump to

Keyboard shortcuts

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