http

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCookieHeader

func BuildCookieHeader(name string, value string, expires *time.Time, domain string, path string, secure bool, httpOnly bool) string

BuidlCookieHeader buidl cookie header, for example, <name>=<value>[;expires=<date>][;domain=<domain_name>][;path=<path>][;secure][;httponly]

func NewError

func NewError(gc *gin.Context, status int, err error)

Types

type Client

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

func NewClient

func NewClient(options ClientOptions, logger *logr.Logger) *Client

func (*Client) Delete

func (c *Client) Delete(target string, headers map[string]string, response interface{}) error

func (*Client) Get

func (c *Client) Get(target string, headers map[string]string, response interface{}) error

func (*Client) GetRaw added in v0.0.6

func (c *Client) GetRaw(target string, headers map[string]string) (string, error)

func (*Client) Patch

func (c *Client) Patch(target string, headers map[string]string, request interface{}, response interface{}) error

func (*Client) Post

func (c *Client) Post(target string, headers map[string]string, request interface{}, response interface{}) error

func (*Client) PostForm

func (c *Client) PostForm(target string, headers map[string]string, request map[string]string, response interface{}) error

func (*Client) Put

func (c *Client) Put(target string, headers map[string]string, request interface{}, response interface{}) error

type ClientOptions

type ClientOptions struct {
	Timeout int    `json:"timeout" yaml:"timeout"`
	CAFile  string `json:"caFile" yaml:"caFile"`
}

ClientOptions http client options

type DummyHealthyHandler added in v0.0.8

type DummyHealthyHandler struct {
}

DummyHealthyHandler dummy health check handler

func NewDummyHealthyHandler added in v0.0.8

func NewDummyHealthyHandler() *DummyHealthyHandler

func (*DummyHealthyHandler) Build added in v0.0.8

func (h *DummyHealthyHandler) Build(engine *gin.Engine)

Build build health check handler

func (*DummyHealthyHandler) Healthz added in v0.0.8

func (h *DummyHealthyHandler) Healthz(gc *gin.Context)

Healthz health check api @Produce json @Summary health check @Description check status @Success 200 {object} StatusResponse @Failure 400 {object} TTPError @Failure 503 {object} HTTPError @Router /healthz [get]

type HTTPError

type HTTPError struct {
	Code    int    `json:"code" example:"400"`
	Message string `json:"message" example:"status bad request"`
}

HTTPError error response

type Handler

type Handler interface {
	Build(engine *gin.Engine)
}

type ProbeManager added in v0.0.8

type ProbeManager struct {
	Probes map[string]*probe.Probe
}

type Server

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

Server http Server

func NewServer

func NewServer(options ServerOptions, logger *logr.Logger, handlers ...Handler) *Server

NewServer create new Server

func (*Server) Start

func (c *Server) Start(ctx context.Context)

Start start http Server

func (*Server) Stop

func (c *Server) Stop(ctx context.Context)

Stop stop API Server

type ServerOptions

type ServerOptions struct {
	Host            string `json:"host" yaml:"host"`
	Port            int    `json:"port" yaml:"port"`
	CAFile          string `json:"caFile" yaml:"caFile"`
	PrivateKeyFile  string `json:"privateKetFile" yaml:"privateKeyFile"`
	PublicCertFile  string `json:"publicCertFile" yaml:"publicCertFile"`
	EnableProfiling bool   `json:"enableProfiling" yaml:"enableProfiling"`
}

Options http server options

type SimpleFSHandler added in v0.0.6

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

func NewSimpleFSHandler added in v0.0.6

func NewSimpleFSHandler(fsPath string, relativePath string) *SimpleFSHandler

func (*SimpleFSHandler) Build added in v0.0.6

func (f *SimpleFSHandler) Build(engine *gin.Engine)

Build build health check handler

type SimpleHealthyHandler added in v0.0.8

type SimpleHealthyHandler struct {
}

SimpleHealthyHandler simple health check handler

func NewSimpleHealthyHandler added in v0.0.8

func NewSimpleHealthyHandler() *SimpleHealthyHandler

func (*SimpleHealthyHandler) Build added in v0.0.8

func (h *SimpleHealthyHandler) Build(engine *gin.Engine)

Build build health check handler

func (*SimpleHealthyHandler) Healthz added in v0.0.8

func (h *SimpleHealthyHandler) Healthz(gc *gin.Context)

Healthz health check api @Produce json @Summary health check @Description check status @Success 200 {object} StatusResponse @Failure 400 {object} TTPError @Failure 503 {object} HTTPError @Router /healthz [get]

type StatusResponse

type StatusResponse struct {
	Message string `json:"message"`
}

StatusResponse status response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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