client

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client provides a client for the opampcommander API server.

Index

Constants

View Source
const (
	// ListAgentURL is the path to list all agents.
	ListAgentURL = "/v1/agents"
	// GetAgentURL is the path to get an agent by ID.
	GetAgentURL = "/v1/agents/:id"
)
View Source
const (
	// ListConnectionsPath is the path to list all connections.
	ListConnectionsPath = "/v1/connections"
	// GetConnectionPath is the path to get a connection by ID.
	GetConnectionPath = "/v1/connections/:id"
)

API paths for connection resources.

Variables

View Source
var (
	// ErrEmptyResponse is an error that indicates that the response from the server is empty.
	ErrEmptyResponse = errors.New("empty response")
	// ErrUnexpectedBehavior is an error that indicates that the server behavior is not as expected.
	ErrUnexpectedBehavior = errors.New("unexpected behavior")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Endpoint string
	Client   *resty.Client
}

Client is a struct that contains the endpoint and the resty client.

func NewClient

func NewClient(endpoint string) *Client

NewClient creates a new client for opampcommander's apiserver.

func (*Client) GetAgent

func (c *Client) GetAgent(id uuid.UUID) (*agentv1.Agent, error)

GetAgent retrieves an agent by its ID.

func (*Client) GetConnection

func (c *Client) GetConnection(id uuid.UUID) (*connectionv1.Connection, error)

GetConnection retrieves a connection by its ID.

func (*Client) ListAgents

func (c *Client) ListAgents() ([]*agentv1.Agent, error)

ListAgents lists all agents.

func (*Client) ListConnections

func (c *Client) ListConnections() ([]*connectionv1.Connection, error)

ListConnections lists all connections.

type ResponseError

type ResponseError struct {
	StatusCode int
}

ResponseError represents an error that occurs when the response from the server is not as expected. It contains the status code of the response.

func (*ResponseError) Error

func (e *ResponseError) Error() string

Error implements the error interface for ResponseError.

Jump to

Keyboard shortcuts

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