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 ¶
- func MetricCollectionMiddleware(next http.Handler) http.Handler
- func RemoteAddrMiddleware(log *logging.Logger, next http.Handler) http.Handler
- type JSONPb
- func (*JSONPb) ContentType(interface{}) string
- func (j *JSONPb) Delimiter() []byte
- func (j *JSONPb) Marshal(v interface{}) ([]byte, error)
- func (j *JSONPb) NewDecoder(r io.Reader) runtime.Decoder
- func (j *JSONPb) NewEncoder(w io.Writer) runtime.Encoder
- func (j *JSONPb) Unmarshal(data []byte, v interface{}) error
- type ProxyServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetricCollectionMiddleware ¶
MetricCollectionMiddleware records the request and the time taken to service it.
Types ¶
type JSONPb ¶
JSONPb is a runtime.Marshaler which marshals/unmarshals into/from.
func (*JSONPb) ContentType ¶
ContentType always returns "application/json".
func (*JSONPb) NewDecoder ¶
NewDecoder returns a runtime.Decoder which reads JSON stream from "r".
func (*JSONPb) NewEncoder ¶
NewEncoder returns an Encoder which writes JSON stream into "w".
type ProxyServer ¶
type ProxyServer struct {
// 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 api.Config) *ProxyServer
NewProxyServer returns a new instance of the rest proxy server.
func (*ProxyServer) ReloadConf ¶
func (s *ProxyServer) ReloadConf(cfg api.Config)
ReloadConf update the internal configuration of the server.