Back to godoc.org

Package server

v0.30.2
Latest Go to latest

The highest tagged major version is .

Published: Aug 13, 2020 | License: Apache-2.0 | Module: github.com/artefactual-labs/enduro

Index

func DecodeListRequest

func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListRequest returns a decoder for requests sent to the pipeline list endpoint.

func DecodeShowRequest

func DecodeShowRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeShowRequest returns a decoder for requests sent to the pipeline show endpoint.

func EncodeListResponse

func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListResponse returns an encoder for responses returned by the pipeline list endpoint.

func EncodeShowError

func EncodeShowError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeShowError returns an encoder for errors returned by the show pipeline endpoint.

func EncodeShowResponse

func EncodeShowResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeShowResponse returns an encoder for responses returned by the pipeline show endpoint.

func ListPipelinePath

func ListPipelinePath() string

ListPipelinePath returns the URL path to the pipeline service list HTTP endpoint.

func Mount

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

Mount configures the mux to serve the pipeline endpoints.

func MountCORSHandler

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

MountCORSHandler configures the mux to serve the CORS endpoints for the service pipeline.

func MountListHandler

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

MountListHandler configures the mux to serve the "pipeline" service "list" endpoint.

func MountShowHandler

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

MountShowHandler configures the mux to serve the "pipeline" service "show" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

NewCORSHandler creates a HTTP handler which returns a simple 200 response.

func NewListHandler

func NewListHandler(
	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(err error) goahttp.Statuser,
) http.Handler

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "pipeline" service "list" endpoint.

func NewListPayload

func NewListPayload(name *string) *pipeline.ListPayload

NewListPayload builds a pipeline service list endpoint payload.

func NewShowHandler

func NewShowHandler(
	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(err error) goahttp.Statuser,
) http.Handler

NewShowHandler creates a HTTP handler which loads the HTTP request and calls the "pipeline" service "show" endpoint.

func NewShowPayload

func NewShowPayload(id string) *pipeline.ShowPayload

NewShowPayload builds a pipeline service show endpoint payload.

func ShowPipelinePath

func ShowPipelinePath(id string) string

ShowPipelinePath returns the URL path to the pipeline service show HTTP endpoint.

type EnduroStoredPipelineResponse

type EnduroStoredPipelineResponse struct {
	// Name of the collection
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Name of the collection
	Name string `form:"name" json:"name" xml:"name"`
}

EnduroStoredPipelineResponse is used to define fields on response body types.

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type ListResponseBody

type ListResponseBody []*EnduroStoredPipelineResponse

ListResponseBody is the type of the "pipeline" service "list" endpoint HTTP response body.

func NewListResponseBody

func NewListResponseBody(res []*pipeline.EnduroStoredPipeline) ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "list" endpoint of the "pipeline" 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
	List   http.Handler
	Show   http.Handler
	CORS   http.Handler
}

Server lists the pipeline service endpoint HTTP handlers.

func New

func New(
	e *pipeline.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(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the pipeline 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) 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.

type ShowNotFoundResponseBody

type ShowNotFoundResponseBody struct {
	// Message of error
	Message string `form:"message" json:"message" xml:"message"`
	// Identifier of missing collection
	ID uint `form:"id" json:"id" xml:"id"`
}

ShowNotFoundResponseBody is the type of the "pipeline" service "show" endpoint HTTP response body for the "not_found" error.

func NewShowNotFoundResponseBody

func NewShowNotFoundResponseBody(res *pipeline.NotFound) *ShowNotFoundResponseBody

NewShowNotFoundResponseBody builds the HTTP response body from the result of the "show" endpoint of the "pipeline" service.

type ShowResponseBody

type ShowResponseBody struct {
	// Name of the collection
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Name of the collection
	Name string `form:"name" json:"name" xml:"name"`
}

ShowResponseBody is the type of the "pipeline" service "show" endpoint HTTP response body.

func NewShowResponseBody

func NewShowResponseBody(res *pipelineviews.EnduroStoredPipelineView) *ShowResponseBody

NewShowResponseBody builds the HTTP response body from the result of the "show" endpoint of the "pipeline" service.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier