server

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0, BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeExportRequest

func DecodeExportRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeExportRequest returns a decoder for requests sent to the infohub Export endpoint.

func DecodeImportRequest

func DecodeImportRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeImportRequest returns a decoder for requests sent to the infohub Import endpoint.

func EncodeExportResponse

func EncodeExportResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeExportResponse returns an encoder for responses returned by the infohub Export endpoint.

func EncodeImportResponse

func EncodeImportResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error

EncodeImportResponse returns an encoder for responses returned by the infohub Import endpoint.

func ExportInfohubPath

func ExportInfohubPath(exportName string) string

ExportInfohubPath returns the URL path to the infohub service Export HTTP endpoint.

func ImportInfohubPath

func ImportInfohubPath() string

ImportInfohubPath returns the URL path to the infohub service Import HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the infohub endpoints.

func MountExportHandler

func MountExportHandler(mux goahttp.Muxer, h http.Handler)

MountExportHandler configures the mux to serve the "infohub" service "Export" endpoint.

func MountImportHandler

func MountImportHandler(mux goahttp.Muxer, h http.Handler)

MountImportHandler configures the mux to serve the "infohub" service "Import" endpoint.

func NewExportHandler

func NewExportHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewExportHandler creates a HTTP handler which loads the HTTP request and calls the "infohub" service "Export" endpoint.

func NewExportRequest

func NewExportRequest(exportName string) *infohub.ExportRequest

NewExportRequest builds a infohub service Export endpoint payload.

func NewImportHandler

func NewImportHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

NewImportHandler creates a HTTP handler which loads the HTTP request and calls the "infohub" service "Import" endpoint.

func NewImportRequest

func NewImportRequest(body []byte) *infohub.ImportRequest

NewImportRequest builds a infohub service Import endpoint payload.

Types

type ImportResponseBody

type ImportResponseBody struct {
	// importIds is an array of unique identifiers used as Cache keys to retrieve
	// the imported data entries later.
	ImportIds []string `form:"importIds" json:"importIds" xml:"importIds"`
}

ImportResponseBody is the type of the "infohub" service "Import" endpoint HTTP response body.

func NewImportResponseBody

func NewImportResponseBody(res *infohub.ImportResult) *ImportResponseBody

NewImportResponseBody builds the HTTP response body from the result of the "Import" endpoint of the "infohub" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type Server

type Server struct {
	Mounts []*MountPoint
	Export http.Handler
	Import http.Handler
}

Server lists the infohub service endpoint HTTP handlers.

func New

func New(
	e *infohub.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(ctx context.Context, err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the infohub service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) MethodNames

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the infohub endpoints.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

Jump to

Keyboard shortcuts

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