restapi

package
v0.0.0-...-b257a98 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address           string
	Debug             bool
	InsecureHTTP      bool
	AuthDisabled      bool
	TLSCertFile       string
	TLSKeyFile        string
	WellKnownDisabled bool
	TokenURL          string
	Tracer            opentracing.Tracer
}

Config defines the config options for the API server.

func (*Config) Parse

func (c *Config) Parse() error

Parse parses configuration from commandline flags.

func (*Config) WithDefaultFlags

func (c *Config) WithDefaultFlags() *Config

WithDefaultFlags creates a Config with default address ':8080'

type Routes

type Routes struct {
	*gin.Engine
	DeleteThingsDeviceNameActionsActionNameActionID struct {
		*gin.RouterGroup
	}
	GetThings struct {
		*gin.RouterGroup
	}
	GetThingsDeviceName struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNameActions struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNameActionsActionNameActionID struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNameEvents struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNameEventsEventType struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNameProperties struct {
		*gin.RouterGroup
	}
	GetThingsDeviceNamePropertiesPropertyName struct {
		*gin.RouterGroup
	}
	PostThingsDeviceNameActions struct {
		*gin.RouterGroup
	}
	PutThingsDeviceNameActionsActionNameActionID struct {
		*gin.RouterGroup
	}
	PutThingsDeviceNamePropertiesPropertyName struct {
		*gin.RouterGroup
	}
}

Routes defines all the routes of the Server service.

type Server

type Server struct {
	Routes *Routes

	Title   string
	Version string
	// contains filtered or unexported fields
}

Server defines the Server service.

func NewServer

func NewServer(svc Service, config *Config) *Server

NewServer initializes a new Server service.

func (*Server) ConfigureRoutes

func (s *Server) ConfigureRoutes()

ConfigureRoutes starts the internal configureRoutes methode.

func (*Server) Run

func (s *Server) Run() error

Run runs the Server. It will listen on either HTTP or HTTPS depending on the config passed to NewServer.

func (*Server) RunWithSigHandler

func (s *Server) RunWithSigHandler(shutdown ...func() error) error

RunWithSigHandler runs the Server server with SIGTERM handling automatically enabled. The server will listen for a SIGTERM signal and gracefully shutdown the web server. It's possible to optionally pass any number shutdown functions which will execute one by one after the webserver has been shutdown successfully.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown will gracefully shutdown the Server server.

type Service

type Service interface {
	Healthy() bool
	DeleteThingsDeviceNameActionsActionNameActionID(ctx *gin.Context, params *operations.DeleteThingsDeviceNameActionsActionNameActionIDParams) *api.Response
	GetThings(ctx *gin.Context) *api.Response
	GetThingsDeviceName(ctx *gin.Context, params *operations.GetThingsDeviceNameParams) *api.Response
	GetThingsDeviceNameActions(ctx *gin.Context, params *operations.GetThingsDeviceNameActionsParams) *api.Response
	GetThingsDeviceNameActionsActionNameActionID(ctx *gin.Context, params *operations.GetThingsDeviceNameActionsActionNameActionIDParams) *api.Response
	GetThingsDeviceNameEvents(ctx *gin.Context, params *operations.GetThingsDeviceNameEventsParams) *api.Response
	GetThingsDeviceNameEventsEventType(ctx *gin.Context, params *operations.GetThingsDeviceNameEventsEventTypeParams) *api.Response
	GetThingsDeviceNameProperties(ctx *gin.Context, params *operations.GetThingsDeviceNamePropertiesParams) *api.Response
	GetThingsDeviceNamePropertiesPropertyName(ctx *gin.Context, params *operations.GetThingsDeviceNamePropertiesPropertyNameParams) *api.Response
	PostThingsDeviceNameActions(ctx *gin.Context, params *operations.PostThingsDeviceNameActionsParams) *api.Response
	PutThingsDeviceNameActionsActionNameActionID(ctx *gin.Context, params *operations.PutThingsDeviceNameActionsActionNameActionIDParams) *api.Response
	PutThingsDeviceNamePropertiesPropertyName(ctx *gin.Context, params *operations.PutThingsDeviceNamePropertiesPropertyNameParams) *api.Response
}

Service is the interface that must be implemented in order to provide business logic for the Server service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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