Documentation ¶
Index ¶
- Variables
- func ConnectEtcd(endpoints []string) (keyval.CoreBrokerWatcher, error)
- func ErrorConnectionFailed(host string) error
- func FromEnv(c *Client) 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) ClientVersion() string
- func (c *Client) Close() error
- func (c *Client) ConfigClient() (client.ConfigClient, error)
- func (c *Client) GRPCConn() (*grpc.ClientConn, 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) ModelList(ctx context.Context, opts types.ModelListOptions) ([]types.Model, error)
- func (c *Client) NegotiateAPIVersion(ctx context.Context)
- func (c *Client) NegotiateAPIVersionPing(p types.Ping)
- func (c *Client) Ping(ctx context.Context) (types.Ping, error)
- func (c *Client) SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.KVWithMetadata, error)
- func (c *Client) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*api.BaseValueStatus, error)
- func (c *Client) ServerVersion(ctx context.Context) (types.Version, error)
- func (c *Client) Status(ctx context.Context) (*probe.ExposedStatus, error)
- func (c *Client) VppRunCli(ctx context.Context, cmd string) (reply string, err error)
- type InfraAPIClient
- type KVDBAPIClient
- type KVDBClient
- 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) Put(key string, data []byte, opts ...datasync.PutOption) (err error)
- type ModelAPIClient
- type Opt
- func WithAPIVersionNegotiation() Opt
- func WithEtcdEndpoints(endpoints []string) Opt
- func WithGRPCClient(client *grpc.ClientConn) Opt
- func WithHTTPClient(client *http.Client) Opt
- func WithHTTPHeaders(headers map[string]string) Opt
- func WithHost(host string) Opt
- func WithServiceLabel(label string) Opt
- func WithTimeout(timeout time.Duration) Opt
- func WithVersion(version string) Opt
- type SchedulerAPIClient
- type VppAPIClient
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultAgentHost defines default host address for agent DefaultAgentHost = "127.0.0.1" DefaultPortGRPC = 9111 DefaultPortHTTP = 9191 )
Functions ¶
func ConnectEtcd ¶
func ConnectEtcd(endpoints []string) (keyval.CoreBrokerWatcher, error)
func ErrorConnectionFailed ¶
ErrorConnectionFailed returns an error with host in the error message when connection to agent failed.
func FromEnv ¶
FromEnv configures the client with values from environment variables.
Supported environment variables: - AGENT_HOST to set the url to the agent server. - LIGATO_API_VERSION to set the url to the agent server.
func IsErrConnectionFailed ¶
IsErrConnectionFailed returns true if the error is caused by connection failed.
Types ¶
type APIClient ¶
type APIClient interface { InfraAPIClient ModelAPIClient SchedulerAPIClient VppAPIClient ConfigClient() (client.ConfigClient, error) AgentHost() string ClientVersion() string KVDBClient() (KVDBAPIClient, error) GRPCConn() (*grpc.ClientConn, error) HTTPClient() *http.Client ServerVersion(ctx context.Context) (types.Version, error) NegotiateAPIVersion(ctx context.Context) NegotiateAPIVersionPing(types.Ping) 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 NewClientFromEnv ¶
NewClientFromEnv returns client with options from environment.
func NewClientWithOpts ¶
NewClientWithOpts returns client with ops applied.
func (*Client) ClientVersion ¶
func (*Client) ConfigClient ¶
func (c *Client) ConfigClient() (client.ConfigClient, error)
func (*Client) HTTPClient ¶
func (*Client) KVDBClient ¶
func (c *Client) KVDBClient() (KVDBAPIClient, error)
func (*Client) LoggerList ¶
func (*Client) NegotiateAPIVersion ¶
func (*Client) NegotiateAPIVersionPing ¶
func (*Client) SchedulerDump ¶
func (c *Client) SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.KVWithMetadata, error)
func (*Client) SchedulerValues ¶
func (c *Client) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*api.BaseValueStatus, error)
func (*Client) ServerVersion ¶
ServerVersion returns information of the client and agent host.
type InfraAPIClient ¶
type InfraAPIClient interface { Status(ctx context.Context) (*probe.ExposedStatus, error) Ping(ctx context.Context) (types.Ping, error) LoggerList(ctx context.Context) ([]types.Logger, error) LoggerSet(ctx context.Context, logger, level string) error }
SystemAPIClient defines API client methods for the system
type KVDBAPIClient ¶
type KVDBAPIClient interface { keyval.CoreBrokerWatcher }
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) ListKeys ¶
func (k *KVDBClient) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
func (*KVDBClient) ListValues ¶
func (k *KVDBClient) ListValues(prefix string) (keyval.BytesKeyValIterator, error)
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 WithEtcdEndpoints ¶
func WithGRPCClient ¶
func WithGRPCClient(client *grpc.ClientConn) Opt
WithGRPCClient overrides the grpc client with the specified one
func WithHTTPClient ¶
WithHTTPClient overrides the http client with the specified one
func WithHTTPHeaders ¶
WithHTTPHeaders overrides the client default http headers
func WithServiceLabel ¶
func WithTimeout ¶
WithTimeout configures the time limit for requests made by the HTTP client
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.KVWithMetadata, error) SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*api.BaseValueStatus, error) }
SchedulerAPIClient defines API client methods for the scheduler