server

package
v0.0.0-...-3384764 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package server provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes bearerAuthContextKey = "bearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type Agent

type Agent struct {
	// AgentId Server-generated unique identifier
	AgentId *string `json:"agent_id,omitempty"`

	// Cost Relative cost weight for placement decisions
	Cost *AgentCost `json:"cost,omitempty"`

	// CreateTime Timestamp when the agent was first registered
	CreateTime *time.Time `json:"create_time,omitempty"`

	// Environment Environment label for the agent
	Environment *string `json:"environment,omitempty"`

	// HealthStatus Current health status of the agent
	HealthStatus *AgentHealthStatus `json:"health_status,omitempty"`

	// LastHeartbeat Timestamp of last heartbeat received
	LastHeartbeat *time.Time `json:"last_heartbeat,omitempty"`

	// Name Unique name of the agent
	Name *string `json:"name,omitempty"`

	// ServiceTypes List of service types this agent can provide
	ServiceTypes *[]string `json:"service_types,omitempty"`

	// TopicName NATS topic name for this agent
	TopicName *string `json:"topic_name,omitempty"`

	// UpdateTime Timestamp when the agent was last updated
	UpdateTime *time.Time `json:"update_time,omitempty"`
}

Agent Full agent resource representation

type AgentCost

type AgentCost string

AgentCost Relative cost weight for placement decisions

const (
	AgentCostHigh       AgentCost = "high"
	AgentCostLow        AgentCost = "low"
	AgentCostMedium     AgentCost = "medium"
	AgentCostMediumHigh AgentCost = "medium-high"
	AgentCostMediumLow  AgentCost = "medium-low"
)

Defines values for AgentCost.

func (AgentCost) Valid

func (e AgentCost) Valid() bool

Valid indicates whether the value is a known member of the AgentCost enum.

type AgentHealthStatus

type AgentHealthStatus string

AgentHealthStatus Current health status of the agent

const (
	AgentHealthStatusCongested   AgentHealthStatus = "congested"
	AgentHealthStatusReady       AgentHealthStatus = "ready"
	AgentHealthStatusUnavailable AgentHealthStatus = "unavailable"
)

Defines values for AgentHealthStatus.

func (AgentHealthStatus) Valid

func (e AgentHealthStatus) Valid() bool

Valid indicates whether the value is a known member of the AgentHealthStatus enum.

type AgentHeartbeat200JSONResponse

type AgentHeartbeat200JSONResponse Agent

func (AgentHeartbeat200JSONResponse) VisitAgentHeartbeatResponse

func (response AgentHeartbeat200JSONResponse) VisitAgentHeartbeatResponse(w http.ResponseWriter) error

type AgentHeartbeat400ApplicationProblemPlusJSONResponse

type AgentHeartbeat400ApplicationProblemPlusJSONResponse Error

func (AgentHeartbeat400ApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse

func (response AgentHeartbeat400ApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse(w http.ResponseWriter) error

type AgentHeartbeat404ApplicationProblemPlusJSONResponse

type AgentHeartbeat404ApplicationProblemPlusJSONResponse Error

func (AgentHeartbeat404ApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse

func (response AgentHeartbeat404ApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse(w http.ResponseWriter) error

type AgentHeartbeatJSONRequestBody

type AgentHeartbeatJSONRequestBody = HeartbeatRequest

AgentHeartbeatJSONRequestBody defines body for AgentHeartbeat for application/json ContentType.

type AgentHeartbeatRequestObject

type AgentHeartbeatRequestObject struct {
	AgentId AgentIdPath `json:"agentId"`
	Body    *AgentHeartbeatJSONRequestBody
}

type AgentHeartbeatResponseObject

type AgentHeartbeatResponseObject interface {
	VisitAgentHeartbeatResponse(w http.ResponseWriter) error
}

type AgentHeartbeatdefaultApplicationProblemPlusJSONResponse

type AgentHeartbeatdefaultApplicationProblemPlusJSONResponse struct {
	Body       Error
	StatusCode int
}

func (AgentHeartbeatdefaultApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse

func (response AgentHeartbeatdefaultApplicationProblemPlusJSONResponse) VisitAgentHeartbeatResponse(w http.ResponseWriter) error

type AgentIdPath

type AgentIdPath = string

AgentIdPath defines model for AgentIdPath.

type AgentList

type AgentList struct {
	Agents *[]Agent `json:"agents,omitempty"`

	// NextPageToken Token for retrieving the next page of results
	NextPageToken *string `json:"next_page_token,omitempty"`
}

AgentList Paginated list of agents

type AgentRegistrationRequest

type AgentRegistrationRequest struct {
	// Cost Relative cost weight for placement decisions
	Cost AgentRegistrationRequestCost `json:"cost"`

	// Environment Environment label for the agent
	Environment string `json:"environment"`

	// Name Unique name of the agent
	Name string `json:"name"`

	// ServiceTypes List of service types this agent can provide
	ServiceTypes []string `json:"service_types"`

	// TopicName NATS topic name for this agent (must start with dcm.agent.)
	TopicName string `json:"topic_name"`
}

AgentRegistrationRequest Request body for agent registration

type AgentRegistrationRequestCost

type AgentRegistrationRequestCost string

AgentRegistrationRequestCost Relative cost weight for placement decisions

const (
	AgentRegistrationRequestCostHigh       AgentRegistrationRequestCost = "high"
	AgentRegistrationRequestCostLow        AgentRegistrationRequestCost = "low"
	AgentRegistrationRequestCostMedium     AgentRegistrationRequestCost = "medium"
	AgentRegistrationRequestCostMediumHigh AgentRegistrationRequestCost = "medium-high"
	AgentRegistrationRequestCostMediumLow  AgentRegistrationRequestCost = "medium-low"
)

Defines values for AgentRegistrationRequestCost.

func (AgentRegistrationRequestCost) Valid

Valid indicates whether the value is a known member of the AgentRegistrationRequestCost enum.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CreateAgent200JSONResponse

type CreateAgent200JSONResponse Agent

func (CreateAgent200JSONResponse) VisitCreateAgentResponse

func (response CreateAgent200JSONResponse) VisitCreateAgentResponse(w http.ResponseWriter) error

type CreateAgent201JSONResponse

type CreateAgent201JSONResponse Agent

func (CreateAgent201JSONResponse) VisitCreateAgentResponse

func (response CreateAgent201JSONResponse) VisitCreateAgentResponse(w http.ResponseWriter) error

type CreateAgent400ApplicationProblemPlusJSONResponse

type CreateAgent400ApplicationProblemPlusJSONResponse Error

func (CreateAgent400ApplicationProblemPlusJSONResponse) VisitCreateAgentResponse

func (response CreateAgent400ApplicationProblemPlusJSONResponse) VisitCreateAgentResponse(w http.ResponseWriter) error

type CreateAgent409ApplicationProblemPlusJSONResponse

type CreateAgent409ApplicationProblemPlusJSONResponse Error

func (CreateAgent409ApplicationProblemPlusJSONResponse) VisitCreateAgentResponse

func (response CreateAgent409ApplicationProblemPlusJSONResponse) VisitCreateAgentResponse(w http.ResponseWriter) error

type CreateAgentJSONRequestBody

type CreateAgentJSONRequestBody = AgentRegistrationRequest

CreateAgentJSONRequestBody defines body for CreateAgent for application/json ContentType.

type CreateAgentRequestObject

type CreateAgentRequestObject struct {
	Body *CreateAgentJSONRequestBody
}

type CreateAgentResponseObject

type CreateAgentResponseObject interface {
	VisitCreateAgentResponse(w http.ResponseWriter) error
}

type CreateAgentdefaultApplicationProblemPlusJSONResponse

type CreateAgentdefaultApplicationProblemPlusJSONResponse struct {
	Body       Error
	StatusCode int
}

func (CreateAgentdefaultApplicationProblemPlusJSONResponse) VisitCreateAgentResponse

type Error

type Error struct {
	// Detail Human-readable explanation specific to this occurrence
	Detail *string `json:"detail,omitempty"`

	// Instance URI reference for this specific error occurrence
	Instance *string `json:"instance,omitempty"`

	// Status HTTP status code
	Status *int `json:"status,omitempty"`

	// Title Short human-readable summary of the problem
	Title string `json:"title"`

	// Type URI reference identifying the error type
	Type string `json:"type"`
}

Error RFC 7807 compliant error response

type GetAgent200JSONResponse

type GetAgent200JSONResponse Agent

func (GetAgent200JSONResponse) VisitGetAgentResponse

func (response GetAgent200JSONResponse) VisitGetAgentResponse(w http.ResponseWriter) error

type GetAgent400ApplicationProblemPlusJSONResponse

type GetAgent400ApplicationProblemPlusJSONResponse Error

func (GetAgent400ApplicationProblemPlusJSONResponse) VisitGetAgentResponse

func (response GetAgent400ApplicationProblemPlusJSONResponse) VisitGetAgentResponse(w http.ResponseWriter) error

type GetAgent404ApplicationProblemPlusJSONResponse

type GetAgent404ApplicationProblemPlusJSONResponse Error

func (GetAgent404ApplicationProblemPlusJSONResponse) VisitGetAgentResponse

func (response GetAgent404ApplicationProblemPlusJSONResponse) VisitGetAgentResponse(w http.ResponseWriter) error

type GetAgentRequestObject

type GetAgentRequestObject struct {
	AgentId AgentIdPath `json:"agentId"`
}

type GetAgentResponseObject

type GetAgentResponseObject interface {
	VisitGetAgentResponse(w http.ResponseWriter) error
}

type GetAgentdefaultApplicationProblemPlusJSONResponse

type GetAgentdefaultApplicationProblemPlusJSONResponse struct {
	Body       Error
	StatusCode int
}

func (GetAgentdefaultApplicationProblemPlusJSONResponse) VisitGetAgentResponse

type HeartbeatRequest

type HeartbeatRequest struct {
	// ConsumerLag Number of unprocessed messages in the agent's NATS consumer
	ConsumerLag int64 `json:"consumer_lag"`

	// Timestamp Timestamp of this heartbeat (used for monotonicity check)
	Timestamp time.Time `json:"timestamp"`
}

HeartbeatRequest Request body for agent heartbeat

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type ListAgents200JSONResponse

type ListAgents200JSONResponse AgentList

func (ListAgents200JSONResponse) VisitListAgentsResponse

func (response ListAgents200JSONResponse) VisitListAgentsResponse(w http.ResponseWriter) error

type ListAgents400ApplicationProblemPlusJSONResponse

type ListAgents400ApplicationProblemPlusJSONResponse Error

func (ListAgents400ApplicationProblemPlusJSONResponse) VisitListAgentsResponse

func (response ListAgents400ApplicationProblemPlusJSONResponse) VisitListAgentsResponse(w http.ResponseWriter) error

type ListAgentsParams

type ListAgentsParams struct {
	// HealthStatus Filter agents by health status
	HealthStatus *ListAgentsParamsHealthStatus `form:"health_status,omitempty" json:"health_status,omitempty"`

	// MaxPageSize Maximum number of results per page
	MaxPageSize *int `form:"max_page_size,omitempty" json:"max_page_size,omitempty"`

	// PageToken Token for pagination
	PageToken *string `form:"page_token,omitempty" json:"page_token,omitempty"`
}

ListAgentsParams defines parameters for ListAgents.

type ListAgentsParamsHealthStatus

type ListAgentsParamsHealthStatus string

ListAgentsParamsHealthStatus defines parameters for ListAgents.

const (
	ListAgentsParamsHealthStatusCongested   ListAgentsParamsHealthStatus = "congested"
	ListAgentsParamsHealthStatusReady       ListAgentsParamsHealthStatus = "ready"
	ListAgentsParamsHealthStatusUnavailable ListAgentsParamsHealthStatus = "unavailable"
)

Defines values for ListAgentsParamsHealthStatus.

func (ListAgentsParamsHealthStatus) Valid

Valid indicates whether the value is a known member of the ListAgentsParamsHealthStatus enum.

type ListAgentsRequestObject

type ListAgentsRequestObject struct {
	Params ListAgentsParams
}

type ListAgentsResponseObject

type ListAgentsResponseObject interface {
	VisitListAgentsResponse(w http.ResponseWriter) error
}

type ListAgentsdefaultApplicationProblemPlusJSONResponse

type ListAgentsdefaultApplicationProblemPlusJSONResponse struct {
	Body       Error
	StatusCode int
}

func (ListAgentsdefaultApplicationProblemPlusJSONResponse) VisitListAgentsResponse

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// List all agents
	// (GET /agents)
	ListAgents(w http.ResponseWriter, r *http.Request, params ListAgentsParams)
	// Register an agent
	// (POST /agents)
	CreateAgent(w http.ResponseWriter, r *http.Request)
	// Get an agent
	// (GET /agents/{agentId})
	GetAgent(w http.ResponseWriter, r *http.Request, agentId AgentIdPath)
	// Send agent heartbeat
	// (PUT /agents/{agentId}/heartbeat)
	AgentHeartbeat(w http.ResponseWriter, r *http.Request, agentId AgentIdPath)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AgentHeartbeat

func (siw *ServerInterfaceWrapper) AgentHeartbeat(w http.ResponseWriter, r *http.Request)

AgentHeartbeat operation middleware

func (*ServerInterfaceWrapper) CreateAgent

func (siw *ServerInterfaceWrapper) CreateAgent(w http.ResponseWriter, r *http.Request)

CreateAgent operation middleware

func (*ServerInterfaceWrapper) GetAgent

func (siw *ServerInterfaceWrapper) GetAgent(w http.ResponseWriter, r *http.Request)

GetAgent operation middleware

func (*ServerInterfaceWrapper) ListAgents

func (siw *ServerInterfaceWrapper) ListAgents(w http.ResponseWriter, r *http.Request)

ListAgents operation middleware

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHandlerFunc

type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, request any) (any, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {
	// List all agents
	// (GET /agents)
	ListAgents(ctx context.Context, request ListAgentsRequestObject) (ListAgentsResponseObject, error)
	// Register an agent
	// (POST /agents)
	CreateAgent(ctx context.Context, request CreateAgentRequestObject) (CreateAgentResponseObject, error)
	// Get an agent
	// (GET /agents/{agentId})
	GetAgent(ctx context.Context, request GetAgentRequestObject) (GetAgentResponseObject, error)
	// Send agent heartbeat
	// (PUT /agents/{agentId}/heartbeat)
	AgentHeartbeat(ctx context.Context, request AgentHeartbeatRequestObject) (AgentHeartbeatResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) AgentHeartbeat

func (_ Unimplemented) AgentHeartbeat(w http.ResponseWriter, r *http.Request, agentId AgentIdPath)

Send agent heartbeat (PUT /agents/{agentId}/heartbeat)

func (Unimplemented) CreateAgent

func (_ Unimplemented) CreateAgent(w http.ResponseWriter, r *http.Request)

Register an agent (POST /agents)

func (Unimplemented) GetAgent

func (_ Unimplemented) GetAgent(w http.ResponseWriter, r *http.Request, agentId AgentIdPath)

Get an agent (GET /agents/{agentId})

func (Unimplemented) ListAgents

func (_ Unimplemented) ListAgents(w http.ResponseWriter, r *http.Request, params ListAgentsParams)

List all agents (GET /agents)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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