Documentation ¶
Index ¶
- Constants
- func ErrorConnectionFailed(host string) error
- func IsErrConnectionFailed(err error) bool
- func ParseHostURL(host string) (*url.URL, error)
- type APIClient
- type Client
- func (c *Client) AgentHost() string
- func (c *Client) AgentVersion(ctx context.Context) (*types.Version, error)
- func (c *Client) Close() error
- func (c *Client) ConfiguratorClient() (configurator.ConfiguratorServiceClient, error)
- func (c *Client) GRPCConn() (*grpc.ClientConn, error)
- func (c *Client) GenericClient() (client.GenericClient, error)
- func (c *Client) GetMetricData(ctx context.Context, metricName string) (map[string]interface{}, error)
- func (c *Client) GoVPPProxyClient() (*proxy.Client, error)
- func (c *Client) HTTPClient() *http.Client
- func (c *Client) KVDBClient() (KVDBAPIClient, error)
- func (c *Client) LoggerList(ctx context.Context) ([]types.Logger, error)
- func (c *Client) LoggerSet(ctx context.Context, logger, level string) error
- func (c *Client) MetaServiceClient() (generic.MetaServiceClient, error)
- func (c *Client) ModelList(ctx context.Context, opts types.ModelListOptions) ([]types.Model, error)
- func (c *Client) NegotiateAPIVersion(ctx context.Context)
- func (c *Client) NegotiateAPIVersionPing(p *types.Version)
- func (c *Client) SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.RecordedKVWithMetadata, error)
- func (c *Client) SchedulerHistory(ctx context.Context, opts types.SchedulerHistoryOptions) (api.RecordedTxns, error)
- func (c *Client) SchedulerResync(ctx context.Context, opts types.SchedulerResyncOptions) (*api.RecordedTxn, error)
- func (c *Client) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*kvscheduler.BaseValueStatus, error)
- func (c *Client) Status(ctx context.Context) (*probe.ExposedStatus, error)
- func (c *Client) Version() string
- func (c *Client) VppGetBufferStats() (*api.BufferStats, error)
- func (c *Client) VppGetErrorStats() (*api.ErrorStats, error)
- func (c *Client) VppGetInterfaceStats() (*api.InterfaceStats, error)
- func (c *Client) VppGetNodeStats() (*api.NodeStats, error)
- func (c *Client) VppGetStats(ctx context.Context, typ string) error
- func (c *Client) VppGetSystemStats() (*api.SystemStats, error)
- func (c *Client) VppRunCli(ctx context.Context, cmd string) (reply string, err error)
- type InfraAPIClient
- type KVDBAPIClient
- type KVDBClient
- func (k *KVDBClient) CompleteFullKey(key string) (string, error)
- func (k *KVDBClient) Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
- func (k *KVDBClient) GetValue(key string) (data []byte, found bool, revision int64, err error)
- func (k *KVDBClient) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
- func (k *KVDBClient) ListValues(prefix string) (keyval.BytesKeyValIterator, error)
- func (k *KVDBClient) ProtoBroker() keyval.ProtoBroker
- func (k *KVDBClient) Put(key string, data []byte, opts ...datasync.PutOption) (err error)
- type MetricsAPIClient
- type ModelAPIClient
- type Opt
- func WithAPIVersionNegotiation() Opt
- func WithEtcdDialTimeout(t time.Duration) Opt
- func WithEtcdEndpoints(endpoints []string) Opt
- func WithGRPCClient(client *grpc.ClientConn) Opt
- func WithGrpcPort(p int) Opt
- func WithGrpcTLS(cert, key, ca string, skipVerify bool) Opt
- func WithHTTPBasicAuth(s string) Opt
- func WithHTTPClient(client *http.Client) Opt
- func WithHTTPHeader(k, v string) Opt
- func WithHTTPPort(p int) Opt
- func WithHTTPTLS(cert, key, ca string, skipVerify bool) Opt
- func WithHost(host string) Opt
- func WithKvdbTLS(cert, key, ca string, skipVerify bool) Opt
- func WithServiceLabel(label string) Opt
- func WithTimeout(timeout time.Duration) Opt
- func WithUserAgent(a string) Opt
- func WithVersion(version string) Opt
- type SchedulerAPIClient
- type VppAPIClient
- type VppStatsAPIClient
Constants ¶
const ( // DefaultAgentHost defines default host address for agent. DefaultAgentHost = "127.0.0.1" // DefaultPortGRPC defines default port for GRPC connection. DefaultPortGRPC = 9111 // DefaultPortHTTP defines default port for HTTP connection. DefaultPortHTTP = 9191 )
const ( // DefaultTimeout defines default timeout for client HTTP requests. DefaultTimeout = time.Second * 120 // DefaultEtcdDialTimeout defines default timeout for dialing Etcd. DefaultEtcdDialTimeout = time.Second * 3 // DefaultEtcdOpTimeout defines default timeout for a pending Etcd operation. DefaultEtcdOpTimeout = time.Second * 10 )
Constants for etcd connection.
Variables ¶
This section is empty.
Functions ¶
func ErrorConnectionFailed ¶
ErrorConnectionFailed returns an error with host in the error message when connection to agent failed.
func IsErrConnectionFailed ¶
IsErrConnectionFailed returns true if the error is caused by connection failed.
Types ¶
type APIClient ¶
type APIClient interface { InfraAPIClient ModelAPIClient SchedulerAPIClient VppAPIClient MetricsAPIClient GenericClient() (client.GenericClient, error) ConfiguratorClient() (configurator.ConfiguratorServiceClient, error) MetaServiceClient() (generic.MetaServiceClient, error) AgentHost() string Version() string KVDBClient() (KVDBAPIClient, error) GRPCConn() (*grpc.ClientConn, error) HTTPClient() *http.Client AgentVersion(ctx context.Context) (*types.Version, error) NegotiateAPIVersion(ctx context.Context) NegotiateAPIVersionPing(version *types.Version) Close() error }
APIClient is an interface that clients that talk with a agent server must implement.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs all operations against a Ligato agent.
func NewClientWithOpts ¶
NewClientWithOpts returns client with ops applied.
func (*Client) AgentVersion ¶ added in v3.2.0
AgentVersion returns information about Agent.
func (*Client) ConfiguratorClient ¶ added in v3.2.0
func (c *Client) ConfiguratorClient() (configurator.ConfiguratorServiceClient, error)
ConfiguratorClient returns "config" with gRPC connection.
func (*Client) GRPCConn ¶
func (c *Client) GRPCConn() (*grpc.ClientConn, error)
GRPCConn returns configured gRPC client.
func (*Client) GenericClient ¶ added in v3.2.0
func (c *Client) GenericClient() (client.GenericClient, error)
func (*Client) GetMetricData ¶
func (*Client) GoVPPProxyClient ¶ added in v3.3.0
GoVPPProxyClient returns configured GoVPP proxy client that is already connected to the exposed GoVPP proxy from vpp-agent
func (*Client) HTTPClient ¶
HTTPClient returns configured HTTP client.
func (*Client) KVDBClient ¶
func (c *Client) KVDBClient() (KVDBAPIClient, error)
KVDBClient returns configured KVDB client.
func (*Client) LoggerList ¶
LoggerList returns list of all registered loggers in Agent.
func (*Client) MetaServiceClient ¶ added in v3.3.0
func (c *Client) MetaServiceClient() (generic.MetaServiceClient, error)
MetaServiceClient creates new client for using meta service
func (*Client) NegotiateAPIVersion ¶
func (*Client) NegotiateAPIVersionPing ¶
func (*Client) SchedulerDump ¶
func (c *Client) SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.RecordedKVWithMetadata, error)
func (*Client) SchedulerHistory ¶ added in v3.2.0
func (c *Client) SchedulerHistory(ctx context.Context, opts types.SchedulerHistoryOptions) (api.RecordedTxns, error)
func (*Client) SchedulerResync ¶ added in v3.2.0
func (c *Client) SchedulerResync(ctx context.Context, opts types.SchedulerResyncOptions) (*api.RecordedTxn, error)
func (*Client) SchedulerValues ¶
func (c *Client) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*kvscheduler.BaseValueStatus, error)
func (*Client) VppGetBufferStats ¶ added in v3.3.0
func (c *Client) VppGetBufferStats() (*api.BufferStats, error)
func (*Client) VppGetErrorStats ¶ added in v3.3.0
func (c *Client) VppGetErrorStats() (*api.ErrorStats, error)
func (*Client) VppGetInterfaceStats ¶ added in v3.3.0
func (c *Client) VppGetInterfaceStats() (*api.InterfaceStats, error)
func (*Client) VppGetNodeStats ¶ added in v3.3.0
func (*Client) VppGetStats ¶ added in v3.2.0
func (*Client) VppGetSystemStats ¶ added in v3.3.0
func (c *Client) VppGetSystemStats() (*api.SystemStats, error)
type InfraAPIClient ¶
type InfraAPIClient interface { Status(ctx context.Context) (*probe.ExposedStatus, error) LoggerList(ctx context.Context) ([]types.Logger, error) LoggerSet(ctx context.Context, logger, level string) error }
InfraAPIClient defines API client methods for the system
type KVDBAPIClient ¶
type KVDBAPIClient interface { keyval.CoreBrokerWatcher ProtoBroker() keyval.ProtoBroker CompleteFullKey(key string) (string, error) }
type KVDBClient ¶
type KVDBClient struct { keyval.CoreBrokerWatcher // contains filtered or unexported fields }
KVDBClient provides client access to the KVDB server.
func NewKVDBClient ¶
func NewKVDBClient(kvdb keyval.CoreBrokerWatcher, serviceLabel string) *KVDBClient
func (*KVDBClient) CompleteFullKey ¶
func (k *KVDBClient) CompleteFullKey(key string) (string, error)
func (*KVDBClient) ListKeys ¶
func (k *KVDBClient) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
func (*KVDBClient) ListValues ¶
func (k *KVDBClient) ListValues(prefix string) (keyval.BytesKeyValIterator, error)
func (*KVDBClient) ProtoBroker ¶
func (k *KVDBClient) ProtoBroker() keyval.ProtoBroker
ProtoBroker returns ProtoWrapper with JSON serializer for KVDB connection.
type MetricsAPIClient ¶
type ModelAPIClient ¶
type ModelAPIClient interface {
ModelList(ctx context.Context, opts types.ModelListOptions) ([]types.Model, error)
}
ModelAPIClient defines API client methods for the models
type Opt ¶
func WithAPIVersionNegotiation ¶
func WithAPIVersionNegotiation() Opt
WithAPIVersionNegotiation enables automatic API version negotiation for the client. With this option enabled, the client automatically negotiates the API version to use when making requests. API version negotiation is performed on the first request; subsequent requests will not re-negotiate.
func WithEtcdDialTimeout ¶
WithEtcdDialTimeout overrides dial timeout for KVDB (etcd) connection.
func WithEtcdEndpoints ¶
WithEtcdEndpoints overrides endpoints for KVDB (etcd) connection.
func WithGRPCClient ¶
func WithGRPCClient(client *grpc.ClientConn) Opt
WithGRPCClient overrides the grpc client with the specified one
func WithGrpcTLS ¶
WithGrpcTLS adds tls.Config for gRPC to Client.
func WithHTTPBasicAuth ¶
WithHTTPBasicAuth adds basic auth header to HTTP headers.
func WithHTTPClient ¶
WithHTTPClient overrides the http client with the specified one
func WithHTTPHeader ¶
WithHTTPHeader adds header to HTTP headers.
func WithHTTPTLS ¶
WithHTTPTLS adds tls.Config for HTTP to Client.
func WithKvdbTLS ¶
WithKvdbTLS adds tls.Config for KVDB to Client.
func WithServiceLabel ¶
func WithTimeout ¶
WithTimeout configures the time limit for requests made by the HTTP client
func WithUserAgent ¶ added in v3.2.0
WithUserAgent sets User-Agent in the HTTP headers.
func WithVersion ¶
WithVersion overrides the client version with the specified one. If an empty version is specified, the value will be ignored to allow version negotiation.
type SchedulerAPIClient ¶
type SchedulerAPIClient interface { SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.RecordedKVWithMetadata, error) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*kvscheduler.BaseValueStatus, error) SchedulerResync(ctx context.Context, opts types.SchedulerResyncOptions) (*api.RecordedTxn, error) SchedulerHistory(ctx context.Context, opts types.SchedulerHistoryOptions) (api.RecordedTxns, error) }
SchedulerAPIClient defines API client methods for the scheduler
type VppAPIClient ¶
type VppAPIClient interface { VppStatsAPIClient VppRunCli(ctx context.Context, cmd string) (reply string, err error) }
VppAPIClient defines API client methods for the VPP
type VppStatsAPIClient ¶ added in v3.3.0
type VppStatsAPIClient interface { VppGetStats(ctx context.Context, typ string) error VppGetBufferStats() (*govppapi.BufferStats, error) VppGetNodeStats() (*govppapi.NodeStats, error) VppGetSystemStats() (*govppapi.SystemStats, error) VppGetErrorStats() (*govppapi.ErrorStats, error) VppGetInterfaceStats() (*govppapi.InterfaceStats, error) }
VppStatsAPIClient defines stats API client methods for the VPP