cli

package
v2.5.0-alpha.0...-0e2148d Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogLevel

func SetLogLevel(logLevel string)

SetLogLevel sets the logrus logging level (WarnLevel for empty string).

func UserAgent

func UserAgent() string

UserAgent returns the user agent string used for making API requests

Types

type AgentCli

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

func NewAgentCli

func NewAgentCli(ops ...AgentCliOption) (*AgentCli, error)

NewAgentCli returns a AgentCli instance with all operators applied on it. It applies by default the standard streams.

func (*AgentCli) Apply

func (cli *AgentCli) Apply(ops ...AgentCliOption) error

Apply all the operation on the cli

func (*AgentCli) Client

func (cli *AgentCli) Client() client.APIClient

Client returns the APIClient

func (*AgentCli) ClientInfo

func (cli *AgentCli) ClientInfo() ClientInfo

func (*AgentCli) DefaultVersion

func (cli *AgentCli) DefaultVersion() string

func (*AgentCli) Err

func (cli *AgentCli) Err() io.Writer

func (*AgentCli) In

func (cli *AgentCli) In() *streams.In

func (*AgentCli) Initialize

func (cli *AgentCli) Initialize(opts *ClientOptions, ops ...InitializeOpt) error

Initialize the agentCli runs initialization that must happen after command line flags are parsed.

func (*AgentCli) Out

func (cli *AgentCli) Out() *streams.Out

func (*AgentCli) ServerInfo

func (cli *AgentCli) ServerInfo() ServerInfo

func (*AgentCli) SetIn

func (cli *AgentCli) SetIn(in *streams.In)

type AgentCliOption

type AgentCliOption func(cli *AgentCli) error

AgentCliOption applies a modification on a AgentCli.

func WithClient

func WithClient(c client.APIClient) AgentCliOption

WithClient sets an APIClient.

func WithCombinedStreams

func WithCombinedStreams(combined io.Writer) AgentCliOption

WithCombinedStreams uses the same stream for the output and error streams.

func WithErrorStream

func WithErrorStream(err io.Writer) AgentCliOption

WithErrorStream sets a cli error stream.

func WithInputStream

func WithInputStream(in io.ReadCloser) AgentCliOption

WithInputStream sets a cli input stream.

func WithOutputStream

func WithOutputStream(out io.Writer) AgentCliOption

WithOutputStream sets a cli output stream.

func WithStandardStreams

func WithStandardStreams() AgentCliOption

WithStandardStreams sets a cli in, out and err streams with the standard streams.

type Cli

type Cli interface {
	Client() client.APIClient

	Out() *streams.Out
	Err() io.Writer
	In() *streams.In
	SetIn(in *streams.In)
	Apply(ops ...AgentCliOption) error
	ServerInfo() ServerInfo
	ClientInfo() ClientInfo
	DefaultVersion() string
}

Cli represents the agent command line client.

type ClientInfo

type ClientInfo struct {
	DefaultVersion string
}

ClientInfo stores details about the supported features of the client

type ClientOptions

type ClientOptions struct {
	Debug    bool
	LogLevel string
}

ClientOptions define options for the client.

func NewClientOptions

func NewClientOptions() *ClientOptions

NewClientOptions returns a new ClientOptions

func (*ClientOptions) InstallFlags

func (opts *ClientOptions) InstallFlags(flags *pflag.FlagSet)

InstallFlags adds flags for the common options on the FlagSet

type Config

type Config struct {
	LigatoAPIVersion string        `json:"ligato-api-version"`
	Host             string        `json:"host"`
	ServiceLabel     string        `json:"service-label"`
	GRPCPort         int           `json:"grpc-port"`
	HTTPPort         int           `json:"http-port"`
	HTTPBasicAuth    string        `json:"http-basic-auth"`
	EtcdEndpoints    []string      `json:"etcd-endpoints"`
	EtcdDialTimeout  time.Duration `json:"etcd-dial-timeout"`
	InsecureTLS      bool          `json:"insecure-tls"`
	GRPCSecure       *TLSConfig    `json:"grpc-tls"`
	HTTPSecure       *TLSConfig    `json:"http-tls"`
	KVDBSecure       *TLSConfig    `json:"kvdb-tls"`
}

Config represents configuration for AgentCTL.

func MakeConfig

func MakeConfig() (*Config, error)

MakeConfig returns new Config with values from Viper.

func (*Config) DebugOutput

func (c *Config) DebugOutput() string

DebugOutput returns Config as string to be used for debug output.

func (*Config) ShouldUseSecureGRPC

func (c *Config) ShouldUseSecureGRPC() bool

ShouldUseSecureGRPC returns whether or not to use TLS for GRPC connection.

func (*Config) ShouldUseSecureHTTP

func (c *Config) ShouldUseSecureHTTP() bool

ShouldUseSecureHTTP returns whether or not to use TLS for HTTP connection.

func (*Config) ShouldUseSecureKVDB

func (c *Config) ShouldUseSecureKVDB() bool

ShouldUseSecureKVDB returns whether or not to use TLS for KVDB connection.

type InitializeOpt

type InitializeOpt func(agentCli *AgentCli) error

InitializeOpt is the type of the functional options passed to AgentCli.Initialize

type ServerInfo

type ServerInfo struct {
	OSType string
}

ServerInfo stores details about the supported features and platform of the server

type TLSConfig

type TLSConfig struct {
	Disabled   bool   `json:"disabled"`
	CertFile   string `json:"cert-file"`
	KeyFile    string `json:"key-file"`
	CAFile     string `json:"ca-file"`
	SkipVerify bool   `json:"skip-verify"`
}

TLSConfig represents configuration for TLS.

Jump to

Keyboard shortcuts

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