server

package
v0.0.0-...-769f768 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeHealthCheckRequest

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

DecodeHealthCheckRequest returns a decoder for requests sent to the common health_check endpoint.

func EncodeHealthCheckError

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

EncodeHealthCheckError returns an encoder for errors returned by the health_check common endpoint.

func EncodeHealthCheckResponse

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

EncodeHealthCheckResponse returns an encoder for responses returned by the common health_check endpoint.

func HealthCheckCommonPath

func HealthCheckCommonPath() string

HealthCheckCommonPath returns the URL path to the common service health_check HTTP endpoint.

func Mount

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

Mount configures the mux to serve the common endpoints.

func MountHealthCheckHandler

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

MountHealthCheckHandler configures the mux to serve the "common" service "health_check" endpoint.

func NewHealthCheckHandler

func NewHealthCheckHandler(
	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

NewHealthCheckHandler creates a HTTP handler which loads the HTTP request and calls the "common" service "health_check" endpoint.

func NewHealthCheckPayload

func NewHealthCheckPayload() *common.HealthCheckPayload

NewHealthCheckPayload builds a common service health_check endpoint payload.

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 HealthCheckBadRequestResponseBody

type HealthCheckBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckBadRequestResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "bad_request" error.

func NewHealthCheckBadRequestResponseBody

func NewHealthCheckBadRequestResponseBody(res *goa.ServiceError) *HealthCheckBadRequestResponseBody

NewHealthCheckBadRequestResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckClientClosedRequestResponseBody

type HealthCheckClientClosedRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckClientClosedRequestResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "client_closed_request" error.

func NewHealthCheckClientClosedRequestResponseBody

func NewHealthCheckClientClosedRequestResponseBody(res *goa.ServiceError) *HealthCheckClientClosedRequestResponseBody

NewHealthCheckClientClosedRequestResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckConflictResponseBody

type HealthCheckConflictResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckConflictResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "conflict" error.

func NewHealthCheckConflictResponseBody

func NewHealthCheckConflictResponseBody(res *goa.ServiceError) *HealthCheckConflictResponseBody

NewHealthCheckConflictResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckForbiddenResponseBody

type HealthCheckForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckForbiddenResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "forbidden" error.

func NewHealthCheckForbiddenResponseBody

func NewHealthCheckForbiddenResponseBody(res *goa.ServiceError) *HealthCheckForbiddenResponseBody

NewHealthCheckForbiddenResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckGatewayTimeoutResponseBody

type HealthCheckGatewayTimeoutResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckGatewayTimeoutResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "gateway_timeout" error.

func NewHealthCheckGatewayTimeoutResponseBody

func NewHealthCheckGatewayTimeoutResponseBody(res *goa.ServiceError) *HealthCheckGatewayTimeoutResponseBody

NewHealthCheckGatewayTimeoutResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckInternalServerErrorResponseBody

type HealthCheckInternalServerErrorResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckInternalServerErrorResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "internal_server_error" error.

func NewHealthCheckInternalServerErrorResponseBody

func NewHealthCheckInternalServerErrorResponseBody(res *goa.ServiceError) *HealthCheckInternalServerErrorResponseBody

NewHealthCheckInternalServerErrorResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckNotFoundResponseBody

type HealthCheckNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckNotFoundResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "not_found" error.

func NewHealthCheckNotFoundResponseBody

func NewHealthCheckNotFoundResponseBody(res *goa.ServiceError) *HealthCheckNotFoundResponseBody

NewHealthCheckNotFoundResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckNotImplementedResponseBody

type HealthCheckNotImplementedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckNotImplementedResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "not_implemented" error.

func NewHealthCheckNotImplementedResponseBody

func NewHealthCheckNotImplementedResponseBody(res *goa.ServiceError) *HealthCheckNotImplementedResponseBody

NewHealthCheckNotImplementedResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckResponseBody

type HealthCheckResponseBody struct {
	Status string `form:"status" json:"status" xml:"status"`
}

HealthCheckResponseBody is the type of the "common" service "health_check" endpoint HTTP response body.

func NewHealthCheckResponseBody

func NewHealthCheckResponseBody(res *common.HealthCheckResponse) *HealthCheckResponseBody

NewHealthCheckResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckServiceUnavailableResponseBody

type HealthCheckServiceUnavailableResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckServiceUnavailableResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "service_unavailable" error.

func NewHealthCheckServiceUnavailableResponseBody

func NewHealthCheckServiceUnavailableResponseBody(res *goa.ServiceError) *HealthCheckServiceUnavailableResponseBody

NewHealthCheckServiceUnavailableResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckTooManyRequestsResponseBody

type HealthCheckTooManyRequestsResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckTooManyRequestsResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "too_many_requests" error.

func NewHealthCheckTooManyRequestsResponseBody

func NewHealthCheckTooManyRequestsResponseBody(res *goa.ServiceError) *HealthCheckTooManyRequestsResponseBody

NewHealthCheckTooManyRequestsResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" service.

type HealthCheckUnauthorizedResponseBody

type HealthCheckUnauthorizedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

HealthCheckUnauthorizedResponseBody is the type of the "common" service "health_check" endpoint HTTP response body for the "unauthorized" error.

func NewHealthCheckUnauthorizedResponseBody

func NewHealthCheckUnauthorizedResponseBody(res *goa.ServiceError) *HealthCheckUnauthorizedResponseBody

NewHealthCheckUnauthorizedResponseBody builds the HTTP response body from the result of the "health_check" endpoint of the "common" 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
	HealthCheck http.Handler
}

Server lists the common service endpoint HTTP handlers.

func New

func New(
	e *common.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 common 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.

Jump to

Keyboard shortcuts

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