client

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package client provides a client interface to interact with server APIs

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCurrentNotSet   = errors.New("current server is not set")
	ErrCurrentNotFound = errors.New("current server not found")
	ErrServerNotFound  = errors.New("server not found")
)
View Source
var DefaultTLSConfig = &tls.Config{
	InsecureSkipVerify: false,
}

Functions

This section is empty.

Types

type ClientSet

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

func New

func New(server string, opts ...NewClientOption) (*ClientSet, error)

func (*ClientSet) BackendV1

func (c *ClientSet) BackendV1() backendv1.ClientV1

func (*ClientSet) CAV1

func (c *ClientSet) CAV1() cav1.ClientV1

func (*ClientSet) CertificateV1

func (c *ClientSet) CertificateV1() certificatev1.ClientV1

func (*ClientSet) Close

func (c *ClientSet) Close() error

func (*ClientSet) Connect

func (c *ClientSet) Connect()

func (*ClientSet) CredentialV1

func (c *ClientSet) CredentialV1() credentialv1.ClientV1

func (*ClientSet) HealthV1

func (c *ClientSet) HealthV1() *healthv1.ClientV1

func (*ClientSet) PolicyV1

func (c *ClientSet) PolicyV1() policyv1.ClientV1

func (*ClientSet) RouteV1

func (c *ClientSet) RouteV1() routev1.ClientV1

func (*ClientSet) State

func (c *ClientSet) State() connectivity.State

func (*ClientSet) TokenV1

func (c *ClientSet) TokenV1() tokenv1.ClientV1

type Config

type Config struct {
	Version string    `mapstructure:"version" json:"version" yaml:"version"`
	Servers []*Server `mapstructure:"servers" json:"servers" yaml:"servers"`
	Current string    `mapstructure:"current" json:"current" yaml:"current"`
}

func (*Config) AddServer

func (c *Config) AddServer(srv *Server) error

func (*Config) CurrentServer

func (c *Config) CurrentServer() (*Server, error)

func (*Config) GetServer

func (c *Config) GetServer(name string) (*Server, error)

func (*Config) Validate

func (c *Config) Validate() error

type NewClientOption

type NewClientOption func(c *ClientSet) error

func WithBackendClient

func WithBackendClient(backendv1Client backendv1.ClientV1) NewClientOption

func WithCAClient

func WithCAClient(cav1Client cav1.ClientV1) NewClientOption

func WithCertificateClient

func WithCertificateClient(certificatev1Client certificatev1.ClientV1) NewClientOption

func WithCredentialClient

func WithCredentialClient(credentialv1Client credentialv1.ClientV1) NewClientOption

func WithGrpcDialOption

func WithGrpcDialOption(opts ...grpc.DialOption) NewClientOption

func WithIdentity

func WithIdentity(id *identity.AtomicIdentity) NewClientOption

func WithLogger

func WithLogger(l logger.Logger) NewClientOption

func WithPolicyClient

func WithPolicyClient(policyv1Client policyv1.ClientV1) NewClientOption

func WithRouteClient

func WithRouteClient(routev1Client routev1.ClientV1) NewClientOption

func WithTLSConfig

func WithTLSConfig(t *tls.Config) NewClientOption

func WithTLSConfigFromCfg

func WithTLSConfigFromCfg(cfg *Config) NewClientOption

WithTLSConfigFromCfg returns a NewClientOption using the provided client.Config. It runs Validate() on the config before returning. If passed in client config doesn't have tls configuration, then tls config is not set on the client.

func WithTLSConfigFromFlags

func WithTLSConfigFromFlags(f *pflag.FlagSet) NewClientOption

type Server

type Server struct {
	Name      string     `mapstructure:"name" json:"name" yaml:"name"`
	Address   string     `mapstructure:"address" json:"address" yaml:"address"`
	TLSConfig *TLSConfig `mapstructure:"tls" json:"tls" yaml:"tls"`
}

func (*Server) Validate

func (s *Server) Validate() error

type TLSConfig

type TLSConfig struct {
	CA          string `mapstructure:"ca,omitempty" json:"ca,omitempty" yaml:"ca,omitempty"`
	Certificate string `mapstructure:"certificate,omitempty" json:"certificate,omitempty" yaml:"certificate,omitempty"`
	Key         string `mapstructure:"key,omitempty" json:"key,omitempty" yaml:"key,omitempty"`
	Insecure    bool   `mapstructure:"insecure,omitempty" json:"insecure,omitempty" yaml:"insecure,omitempty"`
}

func (*TLSConfig) Validate

func (t *TLSConfig) Validate() error

Directories

Path Synopsis
backend
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
ca
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
certificate
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
credential
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
health
v1
policy
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
route
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.
token
v1
Package v1 is a generated GoMock package.
Package v1 is a generated GoMock package.

Jump to

Keyboard shortcuts

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