v1

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package v1 provides the API server for the application. It includes common API definitions and utilities for version 1 of the API.

Index

Constants

View Source
const (
	// APIVersion is the version of the API.
	APIVersion = "v1"
)
View Source
const (
	// AgentGroupKind is the kind of the agent group resource.
	AgentGroupKind = "AgentGroup"
)
View Source
const (
	// AgentKind is the kind of the agent resource.
	AgentKind = "Agent"
)
View Source
const (
	// ConnectionKind is the kind of the connection resource.
	ConnectionKind = "Connection"
)
View Source
const (
	// ServerKind is the kind of the server.
	ServerKind = "Server"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent added in v0.1.27

type Agent struct {
	// Metadata contains identifying information about the agent.
	Metadata AgentMetadata `json:"metadata"`

	// Spec contains the desired configuration for the agent.
	Spec AgentSpec `json:"spec"`

	// Status contains the observed state of the agent.
	Status AgentStatus `json:"status"`

} // @name Agent

Agent represents an agent which is defined OpAMP protocol. It follows the Kubernetes-style resource structure with Metadata, Spec, and Status.

type AgentAvailableComponents added in v0.1.27

type AgentAvailableComponents struct {
	Components map[string]AgentComponentDetails `json:"components,omitempty"`

} // @name AgentAvailableComponents

AgentAvailableComponents represents the available components of the agent.

type AgentCapabilities added in v0.1.27

type AgentCapabilities uint64

AgentCapabilities is a bitmask representing the capabilities of the agent.

type AgentComponentDetails added in v0.1.27

type AgentComponentDetails struct {
	Type    string `json:"type,omitempty"`
	Version string `json:"version,omitempty"`

} // @name ComponentDetails

AgentComponentDetails represents details of an available component.

type AgentComponentHealth added in v0.1.27

type AgentComponentHealth struct {
	Healthy       bool              `json:"healthy"`
	StartTime     Time              `json:"startTime,omitempty"`
	LastError     string            `json:"lastError,omitempty"`
	Status        string            `json:"status,omitempty"`
	StatusTime    Time              `json:"statusTime,omitempty"`
	ComponentsMap map[string]string `json:"componentsMap,omitempty"`

} // @name AgentComponentHealth

AgentComponentHealth represents the health status of the agent's components.

type AgentConfig added in v0.1.27

type AgentConfig struct {
	Value              string              `json:"value"`
	ContentType        string              `json:"contentType"`
	ConnectionSettings *ConnectionSettings `json:"connectionSettings,omitempty"`
}

AgentConfig represents the remote configuration for agents in the group. @name AgentGroupAgentConfig.

type AgentConfigFile added in v0.1.27

type AgentConfigFile struct {
	Body        string `json:"body"`
	ContentType string `json:"contentType"`

} // @name AgentConfigFile

AgentConfigFile represents a configuration file for the agent.

type AgentConfigMap added in v0.1.27

type AgentConfigMap struct {
	ConfigMap map[string]AgentConfigFile `json:"configMap"`

} // @name AgentConfigMap

AgentConfigMap represents a map of configuration files for the agent.

type AgentCustomCapabilities added in v0.1.27

type AgentCustomCapabilities struct {
	Capabilities []string `json:"capabilities,omitempty"`

} // @name AgentCustomCapabilities

AgentCustomCapabilities represents the custom capabilities of the agent.

type AgentDescription added in v0.1.27

type AgentDescription struct {
	// IdentifyingAttributes are attributes that uniquely identify the agent.
	IdentifyingAttributes map[string]string `json:"identifyingAttributes,omitempty"`
	// NonIdentifyingAttributes are attributes that do not uniquely identify the agent.
	NonIdentifyingAttributes map[string]string `json:"nonIdentifyingAttributes,omitempty"`

} // @name AgentDescription

AgentDescription represents the description of the agent.

type AgentEffectiveConfig added in v0.1.27

type AgentEffectiveConfig struct {
	ConfigMap AgentConfigMap `json:"configMap"`

} // @name AgentEffectiveConfig

AgentEffectiveConfig represents the effective configuration of the agent.

type AgentGroup added in v0.1.27

type AgentGroup struct {
	Metadata Metadata `json:"metadata"`
	Spec     Spec     `json:"spec"`
	Status   Status   `json:"status"`

} // @name AgentGroup

AgentGroup represents a struct that represents an agent group.

type AgentListResponse added in v0.1.27

type AgentListResponse = ListResponse[Agent]

AgentListResponse represents a list of agents with metadata.

func NewAgentListResponse added in v0.1.27

func NewAgentListResponse(agents []Agent, metadata ListMeta) *AgentListResponse

NewAgentListResponse creates a new AgentListResponse with the given agents and metadata.

type AgentMetadata added in v0.1.27

type AgentMetadata struct {
	// InstanceUID is a unique identifier for the agent instance.
	InstanceUID uuid.UUID `json:"instanceUid"`

	// Description is a human-readable description of the agent.
	Description AgentDescription `json:"description"`

	// Capabilities is a bitmask representing the capabilities of the agent.
	Capabilities AgentCapabilities `json:"capabilities"`

	// CustomCapabilities is a map of custom capabilities for the agent.
	CustomCapabilities AgentCustomCapabilities `json:"customCapabilities"`

} // @name AgentMetadata

AgentMetadata contains identifying information about the agent.

type AgentPackageStatus added in v0.1.27

type AgentPackageStatus struct {
	// Name is the name of the package.
	Name string `json:"name"`

} // @name AgentPackageStatus

AgentPackageStatus represents the status of a package in the agent.

type AgentPackageStatuses added in v0.1.27

type AgentPackageStatuses struct {
	Packages                      map[string]AgentPackageStatus `json:"packages"`
	ServerProvidedAllPackagesHash string                        `json:"serverProvidedAllPackagesHash,omitempty"`
	ErrorMessage                  string                        `json:"errorMessage,omitempty"`

} // @name AgentPackageStatuses

AgentPackageStatuses represents the package statuses of the agent.

type AgentRemoteConfig added in v0.1.27

type AgentRemoteConfig struct {
	ConfigMap  map[string]AgentConfigFile `json:"configMap,omitempty"`
	ConfigHash string                     `json:"configHash,omitempty"`

} // @name AgentRemoteConfig

AgentRemoteConfig represents the remote configuration of the agent.

type AgentSelector added in v0.1.27

type AgentSelector struct {
	IdentifyingAttributes    map[string]string `json:"identifyingAttributes"`
	NonIdentifyingAttributes map[string]string `json:"nonIdentifyingAttributes"`
}

AgentSelector defines the criteria for selecting agents to be included in the agent group. @name AgentGroupAgentSelector.

type AgentSpec added in v0.1.27

type AgentSpec struct {
	// NewInstanceUID is a new instance UID to inform the agent of its new identity.
	NewInstanceUID string `json:"newInstanceUid,omitempty"`

	// ConnectionSettings contains connection settings for the agent.
	ConnectionSettings ConnectionSettings `json:"connectionSettings,omitempty"`

	// RemoteConfig is the remote configuration of the agent.
	RemoteConfig AgentRemoteConfig `json:"remoteConfig"`

	// RestartRequiredAt is the time when a restart was requested.
	// If this time is after the agent's start time, the agent should be restarted.
	RestartRequiredAt *Time `json:"restartRequiredAt,omitempty"`

} // @name AgentSpec

AgentSpec contains the desired configuration for the agent.

type AgentStatus added in v0.1.27

type AgentStatus struct {
	// EffectiveConfig is the effective configuration of the agent.
	EffectiveConfig AgentEffectiveConfig `json:"effectiveConfig"`

	// PackageStatuses is a map of package statuses for the agent.
	PackageStatuses AgentPackageStatuses `json:"packageStatuses"`

	// ComponentHealth is the health status of the agent's components.
	ComponentHealth AgentComponentHealth `json:"componentHealth"`

	// AvailableComponents lists components available on the agent.
	AvailableComponents AgentAvailableComponents `json:"availableComponents"`

	// Conditions is a list of conditions that apply to the agent.
	Conditions []Condition `json:"conditions"`

	// Connected indicates if the agent is currently connected.
	Connected bool `json:"connected"`

	// ConnectionType indicates the type of connection the agent is using.
	ConnectionType string `json:"connectionType,omitempty"`

	// SequenceNum is the sequence number from the last AgentToServer message.
	SequenceNum uint64 `json:"sequenceNum,omitempty"`

	// LastReportedAt is the timestamp when the agent last reported its status.
	LastReportedAt string `json:"lastReportedAt,omitempty"`

} // @name AgentStatus

AgentStatus contains the observed state of the agent.

type Attributes added in v0.1.27

type Attributes map[string]string

Attributes represents a map of attributes for the agent group. @name AgentGroupAttributes.

type Condition added in v0.1.27

type Condition struct {
	Type               ConditionType   `json:"type"`
	LastTransitionTime Time            `json:"lastTransitionTime"`
	Status             ConditionStatus `json:"status"`
	Reason             string          `json:"reason"`
	Message            string          `json:"message,omitempty"`

} // @name Condition

Condition represents a condition of an agent group.

type ConditionStatus added in v0.1.27

type ConditionStatus string // @name AgentConditionStatus

ConditionStatus represents the status of an agent condition.

const (
	// ConditionStatusTrue represents a true condition status.
	ConditionStatusTrue ConditionStatus = "True"
	// ConditionStatusFalse represents a false condition status.
	ConditionStatusFalse ConditionStatus = "False"
	// ConditionStatusUnknown represents an unknown condition status.
	ConditionStatusUnknown ConditionStatus = "Unknown"
)

type ConditionType added in v0.1.27

type ConditionType string // @name ConditionType

ConditionType represents the type of an agent condition.

const (
	// ConditionTypeCreated represents the condition when the agent group was created.
	ConditionTypeCreated ConditionType = "Created"
	// ConditionTypeUpdated represents the condition when the agent group was updated.
	ConditionTypeUpdated ConditionType = "Updated"
	// ConditionTypeDeleted represents the condition when the agent group was deleted.
	ConditionTypeDeleted ConditionType = "Deleted"
	// ConditionTypeConnected represents the condition when the agent is connected.
	ConditionTypeConnected ConditionType = "Connected"
	// ConditionTypeHealthy represents the condition when the agent is healthy.
	ConditionTypeHealthy ConditionType = "Healthy"
	// ConditionTypeConfigured represents the condition when the agent has been configured.
	ConditionTypeConfigured ConditionType = "Configured"
	// ConditionTypeRegistered represents the condition when the agent has been registered.
	ConditionTypeRegistered ConditionType = "Registered"
)

type Connection added in v0.1.27

type Connection struct {
	// ID is the unique identifier of the connection.
	ID uuid.UUID `json:"id"`

	// InstanceUID is the unique identifier of the agent instance.
	InstanceUID uuid.UUID `json:"instanceUid"`

	// Type is the type of connection (e.g., "http", "websocket").
	Type string `json:"type"`

	// LastCommunicatedAt is the timestamp of the last communication with the agent.
	LastCommunicatedAt Time `json:"lastCommunicatedAt"`

	// Alive indicates whether the connection is currently alive.
	Alive bool `json:"alive"`

} // @name Connection

Connection represents a connection to an agent. It follows the Kubernetes-style resource structure.

type ConnectionListResponse added in v0.1.27

type ConnectionListResponse = ListResponse[Connection]

ConnectionListResponse represents a list of connections with metadata.

func NewConnectionListResponse added in v0.1.27

func NewConnectionListResponse(connections []Connection, metadata ListMeta) *ConnectionListResponse

NewConnectionListResponse creates a new ConnectionListResponse with the given connections and metadata.

type ConnectionSettings added in v0.1.27

type ConnectionSettings struct {
	// OpAMP contains OpAMP server connection settings.
	OpAMP OpAMPConnectionSettings `json:"opamp,omitempty"`
	// OwnMetrics contains own metrics connection settings.
	OwnMetrics TelemetryConnectionSettings `json:"ownMetrics,omitempty"`
	// OwnLogs contains own logs connection settings.
	OwnLogs TelemetryConnectionSettings `json:"ownLogs,omitempty"`
	// OwnTraces contains own traces connection settings.
	OwnTraces TelemetryConnectionSettings `json:"ownTraces,omitempty"`
	// OtherConnections contains other connection settings mapped by name.
	OtherConnections map[string]OtherConnectionSettings `json:"otherConnections,omitempty"`

} // @name ConnectionSettings

ConnectionSettings represents connection settings for the agent.

type ListMeta

type ListMeta struct {
	Continue           string `json:"continue"`
	RemainingItemCount int64  `json:"remainingItemCount"`

} // @name ListMeta

ListMeta is a struct that contains metadata for list responses.

type ListResponse

type ListResponse[T any] struct {
	Kind       string   `json:"kind"`
	APIVersion string   `json:"apiVersion"`
	Metadata   ListMeta `json:"metadata"`
	Items      []T      `json:"items"`

} // @name ListResponse

ListResponse is a struct that represents the response for listing agents.

type Metadata added in v0.1.27

type Metadata struct {
	Name       string        `json:"name"`
	Priority   int           `json:"priority"`
	Attributes Attributes    `json:"attributes"`
	Selector   AgentSelector `json:"selector"`

} // @name AgentGroupMetadata

Metadata represents metadata information for an agent group.

type OpAMPConnectionSettings added in v0.1.27

type OpAMPConnectionSettings struct {
	// DestinationEndpoint is the URL to connect to the OpAMP server.
	DestinationEndpoint string `json:"destinationEndpoint"`
	// Headers are HTTP headers to include in requests.
	Headers map[string][]string `json:"headers,omitempty"`
	// Certificate contains TLS certificate information.
	Certificate TLSCertificate `json:"certificate,omitempty"`

} // @name OpAMPConnectionSettings

OpAMPConnectionSettings represents OpAMP connection settings.

type OtherConnectionSettings added in v0.1.27

type OtherConnectionSettings struct {
	// DestinationEndpoint is the URL to connect to.
	DestinationEndpoint string `json:"destinationEndpoint"`
	// Headers are HTTP headers to include in requests.
	Headers map[string][]string `json:"headers,omitempty"`
	// Certificate contains TLS certificate information.
	Certificate TLSCertificate `json:"certificate,omitempty"`

} // @name OtherConnectionSettings

OtherConnectionSettings represents other connection settings.

type PingResponse added in v0.1.27

type PingResponse struct {
	// Message is the response message.
	Message string `json:"message"`

} // @name PingResponse

PingResponse is the response for the ping endpoint.

type Server added in v0.1.27

type Server struct {
	ID              string            `json:"id"`
	LastHeartbeatAt Time              `json:"lastHeartbeatAt"`
	Conditions      []ServerCondition `json:"conditions"`

} // @name Server

Server represents an API server instance.

type ServerCondition added in v0.1.27

type ServerCondition struct {
	Type               ServerConditionType   `json:"type"`
	LastTransitionTime Time                  `json:"lastTransitionTime"`
	Status             ServerConditionStatus `json:"status"`
	Reason             string                `json:"reason"`
	Message            string                `json:"message,omitempty"`

} // @name ServerCondition

ServerCondition represents a condition of a server.

type ServerConditionStatus added in v0.1.27

type ServerConditionStatus string // @name ServerConditionStatus

ServerConditionStatus represents the status of a server condition.

const (
	// ServerConditionStatusTrue represents a true condition status.
	ServerConditionStatusTrue ServerConditionStatus = "True"
	// ServerConditionStatusFalse represents a false condition status.
	ServerConditionStatusFalse ServerConditionStatus = "False"
	// ServerConditionStatusUnknown represents an unknown condition status.
	ServerConditionStatusUnknown ServerConditionStatus = "Unknown"
)

type ServerConditionType added in v0.1.27

type ServerConditionType string // @name ServerConditionType

ServerConditionType represents the type of a server condition.

const (
	// ServerConditionTypeRegistered represents the condition when the server was registered.
	ServerConditionTypeRegistered ServerConditionType = "Registered"
	// ServerConditionTypeAlive represents the condition when the server is alive.
	ServerConditionTypeAlive ServerConditionType = "Alive"
)

type ServerListResponse added in v0.1.27

type ServerListResponse = ListResponse[Server]

ServerListResponse represents a list of servers with metadata.

func NewServerListResponse added in v0.1.27

func NewServerListResponse(servers []Server, metadata ListMeta) *ServerListResponse

NewServerListResponse creates a new ServerListResponse with the given servers and metadata.

type Spec added in v0.1.27

type Spec struct {
	AgentConfig *AgentConfig `json:"agentConfig,omitempty"`

} // @name AgentGroupSpec

Spec represents the specification of an agent group.

type Status added in v0.1.27

type Status struct {
	// NumAgents is the total number of agents in the agent group.
	NumAgents int `json:"numAgents"`

	// NumConnectedAgents is the number of connected agents in the agent group.
	NumConnectedAgents int `json:"numConnectedAgents"`

	// NumHealthyAgents is the number of healthy agents in the agent group.
	NumHealthyAgents int `json:"numHealthyAgents"`

	// NumUnhealthyAgents is the number of unhealthy agents in the agent group.
	NumUnhealthyAgents int `json:"numUnhealthyAgents"`

	// NumNotConnectedAgents is the number of not connected agents in the agent group.
	NumNotConnectedAgents int `json:"numNotConnectedAgents"`

	// Conditions is a list of conditions that apply to the agent group.
	Conditions []Condition `json:"conditions"`

} // @name AgentGroupStatus

Status represents the status of an agent group.

type TLSCertificate added in v0.1.27

type TLSCertificate struct {
	// Cert is the PEM-encoded certificate.
	Cert string `json:"cert,omitempty"`
	// PrivateKey is the PEM-encoded private key.
	PrivateKey string `json:"privateKey,omitempty"`
	// CaCert is the PEM-encoded CA certificate.
	CaCert string `json:"caCert,omitempty"`

} // @name TLSCertificate

TLSCertificate represents TLS certificate information.

type TelemetryConnectionSettings added in v0.1.27

type TelemetryConnectionSettings struct {
	// DestinationEndpoint is the URL to send telemetry data to.
	DestinationEndpoint string `json:"destinationEndpoint"`
	// Headers are HTTP headers to include in requests.
	Headers map[string][]string `json:"headers,omitempty"`
	// Certificate contains TLS certificate information.
	Certificate TLSCertificate `json:"certificate,omitempty"`

} // @name TelemetryConnectionSettings

TelemetryConnectionSettings represents telemetry connection settings.

type Time added in v0.1.27

type Time struct {
	time.Time
}

Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.

func Date added in v0.1.27

func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time

Date returns the Time corresponding to the supplied parameters by wrapping time.Date.

func NewTime added in v0.1.27

func NewTime(time time.Time) Time

NewTime returns a wrapped instance of the provided time.

func Now added in v0.1.27

func Now() Time

Now returns the current local time.

func Unix added in v0.1.27

func Unix(sec int64, nsec int64) Time

Unix returns the local time corresponding to the given Unix time by wrapping time.Unix.

func (*Time) Before added in v0.1.27

func (t *Time) Before(u *Time) bool

Before reports whether the time instant t is before u.

func (*Time) DeepCopyInto added in v0.1.27

func (t *Time) DeepCopyInto(out *Time)

DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time type is effectively immutable in the time API, so it is safe to copy-by-assign, despite the presence of (unexported) Pointer fields.

func (*Time) Equal added in v0.1.27

func (t *Time) Equal(u *Time) bool

Equal reports whether the time instant t is equal to u.

func (*Time) IsZero added in v0.1.27

func (t *Time) IsZero() bool

IsZero returns true if the value is nil or time is zero.

func (Time) MarshalJSON added in v0.1.27

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Time) MarshalYAML added in v0.1.27

func (t Time) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (Time) Rfc3339Copy added in v0.1.27

func (t Time) Rfc3339Copy() Time

Rfc3339Copy returns a copy of the Time at second-level precision.

func (*Time) UnmarshalJSON added in v0.1.27

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

func (*Time) UnmarshalYAML added in v0.1.27

func (t *Time) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

Directories

Path Synopsis
Package auth provides the authentication api for the opampcommander application
Package auth provides the authentication api for the opampcommander application
Package command provides the command api model for opampcommander.
Package command provides the command api model for opampcommander.
Package version provides api model for version information.
Package version provides api model for version information.

Jump to

Keyboard shortcuts

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