rest

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package rest contains code for running the REST-to-gRPC gateway.

In order to add a new REST endpoint, add an entry to `gateway/rest/grpc-rest-bindings.yml`.

Run `make proto` to generate (among others) the swagger json file.

Run `make rest_check` to make sure that all the endpoints in the bindings yaml file make it into the swagger json file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGzipHandler added in v0.57.0

func NewGzipHandler(logger logging.Logger, fn http.HandlerFunc) http.HandlerFunc

Types

type HTTPBodyDelimitedMarshaler added in v0.71.0

type HTTPBodyDelimitedMarshaler struct {
	runtime.HTTPBodyMarshaler
	// contains filtered or unexported fields
}

This is because by default the marshaller wants to put a newline between chunks of the stream response.

func (*HTTPBodyDelimitedMarshaler) Delimiter added in v0.71.0

func (o *HTTPBodyDelimitedMarshaler) Delimiter() []byte

type JSONPb

type JSONPb jsonpb.Marshaler

JSONPb is a runtime.Marshaler which marshals/unmarshals into/from.

func (*JSONPb) ContentType

func (*JSONPb) ContentType(interface{}) string

ContentType always returns "application/json".

func (*JSONPb) Delimiter

func (j *JSONPb) Delimiter() []byte

Delimiter for newline encoded JSON streams.

func (*JSONPb) Marshal

func (j *JSONPb) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON.

func (*JSONPb) NewDecoder

func (j *JSONPb) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a runtime.Decoder which reads JSON stream from "r".

func (*JSONPb) NewEncoder

func (j *JSONPb) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes JSON stream into "w".

func (*JSONPb) Unmarshal

func (j *JSONPb) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals JSON "data" into "v". Currently it can only marshal proto.Message.

type ProxyServer

type ProxyServer struct {
	gateway.Config
	// contains filtered or unexported fields
}

ProxyServer implement a rest server acting as a proxy to the grpc api.

func NewProxyServer

func NewProxyServer(log *logging.Logger, config gateway.Config, vegaPaths paths.Paths) *ProxyServer

NewProxyServer returns a new instance of the rest proxy server.

func (*ProxyServer) ReloadConf

func (s *ProxyServer) ReloadConf(cfg gateway.Config)

ReloadConf update the internal configuration of the server.

func (*ProxyServer) Start

func (s *ProxyServer) Start(ctx context.Context) (http.Handler, error)

Start start the server.

Jump to

Keyboard shortcuts

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