httpapi

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(rw http.ResponseWriter, status int, message string, args ...interface{})

Write is a helper for writing ResponseJSON to response writer

func WriteJSON

func WriteJSON(rw http.ResponseWriter, payload interface{}, status int)

Types

type CreateKVRequest

type CreateKVRequest struct {
	Overwrite bool               `json:"overwrite"`
	KVS       []*protos.KVObject `json:"kvs"`
}

type HTTPAPI

type HTTPAPI struct {
	Options *Options
	// contains filtered or unexported fields
}

func New

func New(o *Options) (*HTTPAPI, error)

func (*HTTPAPI) Auth

func (a *HTTPAPI) Auth(handler http.HandlerFunc) http.HandlerFunc

Auth is an auth middleware

func (*HTTPAPI) Run

func (a *HTTPAPI) Run() error

type Options

type Options struct {
	KVService            kv.IKV
	HTTPAPIListenAddress string
	Version              string
	ShutdownContext      context.Context
	Health               health.IHealth
	BusService           bus.IBus
	AuthToken            string
}

type ResponseJSON

type ResponseJSON struct {
	Message string            `json:"message"`
	Values  map[string]string `json:"values,omitempty"`
}

Jump to

Keyboard shortcuts

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