api

package
v0.0.0-...-b7287e2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(ctx context.Context) *conf.GlobalConfiguration

GetConfig reads the global configuration from the context.

func GetMachineID

func GetMachineID(ctx context.Context) string

GetMachineID reads the machine ID from the context.

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID reads the request ID from the context.

func WithConfig

func WithConfig(ctx context.Context, conf *conf.GlobalConfiguration) context.Context

WithConfig adds configuration to the context.

func WithMachineID

func WithMachineID(ctx context.Context, id string) context.Context

WithMachineID adds the machine ID to the context.

func WithRequestID

func WithRequestID(ctx context.Context, id string) context.Context

WithRequestID adds the provided request ID to the context.

Types

type API

type API struct {
	Authentication *auth.Auth

	DB *gorm.DB
	// contains filtered or unexported fields
}

API the rest api

func NewAPI

func NewAPI(ctx context.Context, apiServerConfig *conf.APIConfiguration, appLogger *logger.AppLogger, db *gorm.DB) *API

NewAPI create a new api instance

func (*API) Auth

func (a *API) Auth(rw http.ResponseWriter, req *http.Request) error

Auth endpoint

func (*API) HealthCheck

func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error

HealthCheck endpoint

func (*API) ListenAndServe

func (a *API) ListenAndServe(hostAndPort string)

ListenAndServe starts the api server

Jump to

Keyboard shortcuts

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