api

package
v0.0.0-...-3458964 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Json2Map

func Json2Map(jsonStr string) (map[string]any, error)

func NewOpenTelemetryMiddleware

func NewOpenTelemetryMiddleware() mux.MiddlewareFunc

func NewOss

func NewOss(ens config.Oss) oss.Driver

Types

type ArrayResponse

type ArrayResponse []string

type Config

type Config struct {
	HttpClientTimeout     time.Duration `mapstructure:"http-client-timeout"`
	HttpServerTimeout     time.Duration `mapstructure:"http-server-timeout"`
	ServerShutdownTimeout time.Duration `mapstructure:"server-shutdown-timeout"`
	BackendURL            []string      `mapstructure:"backend-url"`
	UIMessage             string        `mapstructure:"ui-message"`
	UIColor               string        `mapstructure:"ui-color"`
	UIPath                string        `mapstructure:"ui-path"`
	DataPath              string        `mapstructure:"data-path"`
	ConfigPath            string        `mapstructure:"config-path"`
	CertPath              string        `mapstructure:"cert-path"`
	Host                  string        `mapstructure:"host"`
	Port                  string        `mapstructure:"port"`
	SecurePort            string        `mapstructure:"secure-port"`
	PortMetrics           int           `mapstructure:"port-metrics"`
	Hostname              string        `mapstructure:"hostname"`
	H2C                   bool          `mapstructure:"h2c"`
	RandomDelay           bool          `mapstructure:"random-delay"`
	RandomDelayUnit       string        `mapstructure:"random-delay-unit"`
	RandomDelayMin        int           `mapstructure:"random-delay-min"`
	RandomDelayMax        int           `mapstructure:"random-delay-max"`
	RandomError           bool          `mapstructure:"random-error"`
	Unhealthy             bool          `mapstructure:"unhealthy"`
	Unready               bool          `mapstructure:"unready"`
	JWTSecret             string        `mapstructure:"jwt-secret"`
	CacheServer           string        `mapstructure:"cache-server"`
}

type LoggingMiddleware

type LoggingMiddleware struct {
	// contains filtered or unexported fields
}

func NewLoggingMiddleware

func NewLoggingMiddleware(logger *zap.Logger) *LoggingMiddleware

func (*LoggingMiddleware) Handler

func (m *LoggingMiddleware) Handler(next http.Handler) http.Handler

type MapResponse

type MapResponse map[string]string

type PrometheusMiddleware

type PrometheusMiddleware struct {
	Histogram *prometheus.HistogramVec
	Counter   *prometheus.CounterVec
}

func NewPrometheusMiddleware

func NewPrometheusMiddleware() *PrometheusMiddleware

func (*PrometheusMiddleware) Handler

func (p *PrometheusMiddleware) Handler(next http.Handler) http.Handler

Metrics godoc @Summary Prometheus metrics @Description returns HTTP requests duration and Go runtime metrics @Tags Kubernetes @Produce plain @Router /metrics [get] @Success 200 {string} string "OK"

type RandomDelayMiddleware

type RandomDelayMiddleware struct {
	// contains filtered or unexported fields
}

func NewRandomDelayMiddleware

func NewRandomDelayMiddleware(minDelay, maxDelay int, delayUnit string) *RandomDelayMiddleware

func (*RandomDelayMiddleware) Handler

func (m *RandomDelayMiddleware) Handler(next http.Handler) http.Handler

type RuntimeResponse

type RuntimeResponse struct {
	Hostname     string `json:"hostname"`
	Version      string `json:"version"`
	Revision     string `json:"revision"`
	Color        string `json:"color"`
	Message      string `json:"message"`
	GOOS         string `json:"goos"`
	GOARCH       string `json:"goarch"`
	Runtime      string `json:"runtime"`
	NumGoroutine string `json:"num_goroutine"`
	NumCPU       string `json:"num_cpu"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewMockServer

func NewMockServer() *Server

func NewServer

func NewServer(config *Config, logger *zap.Logger) (*Server, error)

func (*Server) ErrorResponse

func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, span trace.Span, error string, code int)

func (*Server) JSONResponse

func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})

func (*Server) JSONResponseCode

func (s *Server) JSONResponseCode(w http.ResponseWriter, r *http.Request, result interface{}, responseCode int)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() (*http.Server, *http.Server, *int32, *int32)

type TokenResponse

type TokenResponse struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

type TokenValidationResponse

type TokenValidationResponse struct {
	TokenName string    `json:"token_name"`
	ExpiresAt time.Time `json:"expires_at"`
}

type UploadApi

type UploadApi struct{}

func (*UploadApi) DeleteImage

func (up *UploadApi) DeleteImage(rc *restfulx.ReqCtx)

func (*UploadApi) GetImage

func (up *UploadApi) GetImage(rc *restfulx.ReqCtx)

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

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