Documentation ¶
Overview ¶
Package server provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.
Index ¶
- Constants
- func CorsMiddleware() gin.HandlerFunc
- func GetSwagger() (swagger *openapi3.T, err error)
- func Healthcheck(ctx context.Context, conn *nats.Conn, store *Store, heartbeatTimoutSec int64, ...)
- func LoggingMiddleware(logger common.ServerLogrus) gin.HandlerFunc
- func NewHttpServer(specpipeServer *SpecpipeServer, logger common.ServerLogrus, port string) *http.Server
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router gin.IRouter, si ServerInterface)
- func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
- type Config
- type ControllerConfig
- type ErrorResponse
- type FmDevice
- type FmDeviceResponse
- type FmDevicesResponse
- type GinServerOptions
- type HealthConfig
- type HttpConfig
- type IqDevice
- type IqDeviceResponse
- type IqDevicesResponse
- type LoggingConfig
- type MiddlewareFunc
- type NatsConfig
- type PutFmDevicesDevicenameJSONRequestBody
- type PutIqDevicesDevicenameJSONRequestBody
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetFmDevices(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetFmDevicesDevicename(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetIqDevices(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetIqDevicesDevicename(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PutFmDevicesDevicename(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PutIqDevicesDevicename(c *gin.Context)
- type SpecpipeServer
- func (s *SpecpipeServer) GetFmDevices(c *gin.Context)
- func (s *SpecpipeServer) GetFmDevicesDevicename(c *gin.Context, deviceName string)
- func (s *SpecpipeServer) GetIqDevices(c *gin.Context)
- func (s *SpecpipeServer) GetIqDevicesDevicename(c *gin.Context, deviceName string)
- func (s *SpecpipeServer) PutFmDevicesDevicename(c *gin.Context, deviceName string)
- func (s *SpecpipeServer) PutIqDevicesDevicename(c *gin.Context, deviceName string)
- type Store
- func (s *Store) DeleteDevice(ctx context.Context, sdrType common.SDRType, deviceName string) error
- func (s *Store) GetDevice(ctx context.Context, sdrType common.SDRType, deviceName string) (bool, common.Device, error)
- func (s *Store) GetDevices(ctx context.Context, sdrType common.SDRType) ([]common.Device, error)
- func (s *Store) UpdateDevice(ctx context.Context, sdrType common.SDRType, deviceName string, ...) error
- type UpdateFmDeviceRequest
- type UpdateIqDeviceRequest
Constants ¶
const JWTAuthHeader = "Authorization"
Variables ¶
This section is empty.
Functions ¶
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Healthcheck ¶
func LoggingMiddleware ¶
func LoggingMiddleware(logger common.ServerLogrus) gin.HandlerFunc
func NewHttpServer ¶
func NewHttpServer(specpipeServer *SpecpipeServer, logger common.ServerLogrus, port string) *http.Server
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router gin.IRouter, si ServerInterface)
RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
RegisterHandlersWithOptions creates http.Handler with additional options
Types ¶
type Config ¶
type Config struct { Controller *ControllerConfig `mapstructure:"controller"` Health *HealthConfig `mapstructure:"health"` }
type ControllerConfig ¶ added in v0.0.3
type ControllerConfig struct { Http *HttpConfig `mapstructure:"http"` Nats *NatsConfig `mapstructure:"nats"` Logging *LoggingConfig `mapstructure:"logging"` }
func NewControllerConfig ¶ added in v0.0.3
func NewControllerConfig() (*ControllerConfig, error)
type ErrorResponse ¶
ErrorResponse defines model for error_response.
type FmDevice ¶
type FmDevice struct { Freq string `json:"freq"` Latitude float32 `json:"latitude"` Longitude float32 `json:"longitude"` Name string `json:"name"` RegisterTs int64 `json:"register_ts"` ResampleRate string `json:"resample_rate"` SampleRate string `json:"sample_rate"` SpecpipeVersion string `json:"specpipe_version"` }
FmDevice defines model for fm_device.
type FmDeviceResponse ¶
type FmDeviceResponse struct {
Device FmDevice `json:"device"`
}
FmDeviceResponse defines model for fm_device_response.
type FmDevicesResponse ¶
type FmDevicesResponse struct {
Devices []FmDevice `json:"devices"`
}
FmDevicesResponse defines model for fm_devices_response.
type GinServerOptions ¶
type GinServerOptions struct { BaseURL string Middlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
GinServerOptions provides options for the Gin server.
type HealthConfig ¶ added in v0.0.3
type HealthConfig struct { TimeoutSec int64 Nats *NatsConfig `mapstructure:"nats"` Logging *LoggingConfig `mapstructure:"logging"` }
func NewHealthConfig ¶ added in v0.0.3
func NewHealthConfig() (*HealthConfig, error)
type HttpConfig ¶
type HttpConfig struct {
ServerPort string
}
type IqDevice ¶
type IqDevice struct { Forward bool `json:"forward"` Freq string `json:"freq"` Latitude float32 `json:"latitude"` Longitude float32 `json:"longitude"` Name string `json:"name"` RegisterTs int64 `json:"register_ts"` SampleRate string `json:"sample_rate"` SpecpipeVersion string `json:"specpipe_version"` }
IqDevice defines model for iq_device.
type IqDeviceResponse ¶
type IqDeviceResponse struct {
Device IqDevice `json:"device"`
}
IqDeviceResponse defines model for iq_device_response.
type IqDevicesResponse ¶
type IqDevicesResponse struct {
Devices []IqDevice `json:"devices"`
}
IqDevicesResponse defines model for iq_devices_response.
type LoggingConfig ¶
type LoggingConfig struct {
Level string
}
type MiddlewareFunc ¶
type NatsConfig ¶
type NatsConfig struct {
Url string
}
type PutFmDevicesDevicenameJSONRequestBody ¶
type PutFmDevicesDevicenameJSONRequestBody = UpdateFmDeviceRequest
PutFmDevicesDevicenameJSONRequestBody defines body for PutFmDevicesDevicename for application/json ContentType.
type PutIqDevicesDevicenameJSONRequestBody ¶
type PutIqDevicesDevicenameJSONRequestBody = UpdateIqDeviceRequest
PutIqDevicesDevicenameJSONRequestBody defines body for PutIqDevicesDevicename for application/json ContentType.
type ServerInterface ¶
type ServerInterface interface { // List FM devices // (GET /fm/devices) GetFmDevices(c *gin.Context) // Read FM device configuration // (GET /fm/devices/{devicename}) GetFmDevicesDevicename(c *gin.Context, devicename string) // Update FM device // (PUT /fm/devices/{devicename}) PutFmDevicesDevicename(c *gin.Context, devicename string) // List IQ devices // (GET /iq/devices) GetIqDevices(c *gin.Context) // Read IQ device configuration // (GET /iq/devices/{devicename}) GetIqDevicesDevicename(c *gin.Context, devicename string) // Update IQ device // (PUT /iq/devices/{devicename}) PutIqDevicesDevicename(c *gin.Context, devicename string) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetFmDevices ¶
func (siw *ServerInterfaceWrapper) GetFmDevices(c *gin.Context)
GetFmDevices operation middleware
func (*ServerInterfaceWrapper) GetFmDevicesDevicename ¶
func (siw *ServerInterfaceWrapper) GetFmDevicesDevicename(c *gin.Context)
GetFmDevicesDevicename operation middleware
func (*ServerInterfaceWrapper) GetIqDevices ¶
func (siw *ServerInterfaceWrapper) GetIqDevices(c *gin.Context)
GetIqDevices operation middleware
func (*ServerInterfaceWrapper) GetIqDevicesDevicename ¶
func (siw *ServerInterfaceWrapper) GetIqDevicesDevicename(c *gin.Context)
GetIqDevicesDevicename operation middleware
func (*ServerInterfaceWrapper) PutFmDevicesDevicename ¶
func (siw *ServerInterfaceWrapper) PutFmDevicesDevicename(c *gin.Context)
PutFmDevicesDevicename operation middleware
func (*ServerInterfaceWrapper) PutIqDevicesDevicename ¶
func (siw *ServerInterfaceWrapper) PutIqDevicesDevicename(c *gin.Context)
PutIqDevicesDevicename operation middleware
type SpecpipeServer ¶
type SpecpipeServer struct {
// contains filtered or unexported fields
}
func NewSpecpipeServer ¶
func NewSpecpipeServer(store *Store) *SpecpipeServer
func (*SpecpipeServer) GetFmDevices ¶
func (s *SpecpipeServer) GetFmDevices(c *gin.Context)
func (*SpecpipeServer) GetFmDevicesDevicename ¶
func (s *SpecpipeServer) GetFmDevicesDevicename(c *gin.Context, deviceName string)
func (*SpecpipeServer) GetIqDevices ¶
func (s *SpecpipeServer) GetIqDevices(c *gin.Context)
func (*SpecpipeServer) GetIqDevicesDevicename ¶
func (s *SpecpipeServer) GetIqDevicesDevicename(c *gin.Context, deviceName string)
func (*SpecpipeServer) PutFmDevicesDevicename ¶
func (s *SpecpipeServer) PutFmDevicesDevicename(c *gin.Context, deviceName string)
func (*SpecpipeServer) PutIqDevicesDevicename ¶
func (s *SpecpipeServer) PutIqDevicesDevicename(c *gin.Context, deviceName string)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteDevice ¶
func (*Store) GetDevices ¶
type UpdateFmDeviceRequest ¶
type UpdateFmDeviceRequest struct { Freq string `json:"freq"` ResampleRate *string `json:"resample_rate,omitempty"` SampleRate *string `json:"sample_rate,omitempty"` }
UpdateFmDeviceRequest defines model for update_fm_device_request.
type UpdateIqDeviceRequest ¶
type UpdateIqDeviceRequest struct { Freq string `json:"freq"` SampleRate *string `json:"sample_rate,omitempty"` }
UpdateIqDeviceRequest defines model for update_iq_device_request.