server

package
v0.0.0-...-520f1c6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatalogErrorCatalogPath

func CatalogErrorCatalogPath(catalogName string) string

CatalogErrorCatalogPath returns the URL path to the catalog service CatalogError HTTP endpoint.

func DecodeCatalogErrorRequest

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

DecodeCatalogErrorRequest returns a decoder for requests sent to the catalog CatalogError endpoint.

func DecodeRefreshAllRequest

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

DecodeRefreshAllRequest returns a decoder for requests sent to the catalog RefreshAll endpoint.

func DecodeRefreshRequest

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

DecodeRefreshRequest returns a decoder for requests sent to the catalog Refresh endpoint.

func EncodeCatalogErrorError

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

EncodeCatalogErrorError returns an encoder for errors returned by the CatalogError catalog endpoint.

func EncodeCatalogErrorResponse

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

EncodeCatalogErrorResponse returns an encoder for responses returned by the catalog CatalogError endpoint.

func EncodeRefreshAllError

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

EncodeRefreshAllError returns an encoder for errors returned by the RefreshAll catalog endpoint.

func EncodeRefreshAllResponse

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

EncodeRefreshAllResponse returns an encoder for responses returned by the catalog RefreshAll endpoint.

func EncodeRefreshError

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

EncodeRefreshError returns an encoder for errors returned by the Refresh catalog endpoint.

func EncodeRefreshResponse

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

EncodeRefreshResponse returns an encoder for responses returned by the catalog Refresh endpoint.

func Mount

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

Mount configures the mux to serve the catalog endpoints.

func MountCORSHandler

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

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

func MountCatalogErrorHandler

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

MountCatalogErrorHandler configures the mux to serve the "catalog" service "CatalogError" endpoint.

func MountRefreshAllHandler

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

MountRefreshAllHandler configures the mux to serve the "catalog" service "RefreshAll" endpoint.

func MountRefreshHandler

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

MountRefreshHandler configures the mux to serve the "catalog" service "Refresh" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

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

func NewCatalogErrorHandler

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

NewCatalogErrorHandler creates a HTTP handler which loads the HTTP request and calls the "catalog" service "CatalogError" endpoint.

func NewCatalogErrorPayload

func NewCatalogErrorPayload(catalogName string, token string) *catalog.CatalogErrorPayload

NewCatalogErrorPayload builds a catalog service CatalogError endpoint payload.

func NewRefreshAllHandler

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

NewRefreshAllHandler creates a HTTP handler which loads the HTTP request and calls the "catalog" service "RefreshAll" endpoint.

func NewRefreshAllPayload

func NewRefreshAllPayload(token string) *catalog.RefreshAllPayload

NewRefreshAllPayload builds a catalog service RefreshAll endpoint payload.

func NewRefreshHandler

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

NewRefreshHandler creates a HTTP handler which loads the HTTP request and calls the "catalog" service "Refresh" endpoint.

func NewRefreshPayload

func NewRefreshPayload(catalogName string, token string) *catalog.RefreshPayload

NewRefreshPayload builds a catalog service Refresh endpoint payload.

func RefreshAllCatalogPath

func RefreshAllCatalogPath() string

RefreshAllCatalogPath returns the URL path to the catalog service RefreshAll HTTP endpoint.

func RefreshCatalogPath

func RefreshCatalogPath(catalogName string) string

RefreshCatalogPath returns the URL path to the catalog service Refresh HTTP endpoint.

Types

type CatalogErrorInternalErrorResponseBody

type CatalogErrorInternalErrorResponseBody 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"`
}

CatalogErrorInternalErrorResponseBody is the type of the "catalog" service "CatalogError" endpoint HTTP response body for the "internal-error" error.

func NewCatalogErrorInternalErrorResponseBody

func NewCatalogErrorInternalErrorResponseBody(res *goa.ServiceError) *CatalogErrorInternalErrorResponseBody

NewCatalogErrorInternalErrorResponseBody builds the HTTP response body from the result of the "CatalogError" endpoint of the "catalog" service.

type CatalogErrorResponseBody

type CatalogErrorResponseBody struct {
	// Catalog errors
	Data []*CatalogErrorsResponseBody `form:"data" json:"data" xml:"data"`
}

CatalogErrorResponseBody is the type of the "catalog" service "CatalogError" endpoint HTTP response body.

func NewCatalogErrorResponseBody

func NewCatalogErrorResponseBody(res *catalog.CatalogErrorResult) *CatalogErrorResponseBody

NewCatalogErrorResponseBody builds the HTTP response body from the result of the "CatalogError" endpoint of the "catalog" service.

type CatalogErrorsResponseBody

type CatalogErrorsResponseBody struct {
	// Catalog Errror type
	Type string `form:"type" json:"type" xml:"type"`
	// Catalog Error message
	Errors []string `form:"errors" json:"errors" xml:"errors"`
}

CatalogErrorsResponseBody 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 JobResponse

type JobResponse struct {
	// id of the job
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of the catalog
	CatalogName string `form:"catalogName" json:"catalogName" xml:"catalogName"`
	// status of the job
	Status string `form:"status" json:"status" xml:"status"`
}

JobResponse is used to define fields on response body types.

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 RefreshAllInternalErrorResponseBody

type RefreshAllInternalErrorResponseBody 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"`
}

RefreshAllInternalErrorResponseBody is the type of the "catalog" service "RefreshAll" endpoint HTTP response body for the "internal-error" error.

func NewRefreshAllInternalErrorResponseBody

func NewRefreshAllInternalErrorResponseBody(res *goa.ServiceError) *RefreshAllInternalErrorResponseBody

NewRefreshAllInternalErrorResponseBody builds the HTTP response body from the result of the "RefreshAll" endpoint of the "catalog" service.

type RefreshAllResponseBody

type RefreshAllResponseBody []*JobResponse

RefreshAllResponseBody is the type of the "catalog" service "RefreshAll" endpoint HTTP response body.

func NewRefreshAllResponseBody

func NewRefreshAllResponseBody(res []*catalog.Job) RefreshAllResponseBody

NewRefreshAllResponseBody builds the HTTP response body from the result of the "RefreshAll" endpoint of the "catalog" service.

type RefreshInternalErrorResponseBody

type RefreshInternalErrorResponseBody 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"`
}

RefreshInternalErrorResponseBody is the type of the "catalog" service "Refresh" endpoint HTTP response body for the "internal-error" error.

func NewRefreshInternalErrorResponseBody

func NewRefreshInternalErrorResponseBody(res *goa.ServiceError) *RefreshInternalErrorResponseBody

NewRefreshInternalErrorResponseBody builds the HTTP response body from the result of the "Refresh" endpoint of the "catalog" service.

type RefreshNotFoundResponseBody

type RefreshNotFoundResponseBody 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"`
}

RefreshNotFoundResponseBody is the type of the "catalog" service "Refresh" endpoint HTTP response body for the "not-found" error.

func NewRefreshNotFoundResponseBody

func NewRefreshNotFoundResponseBody(res *goa.ServiceError) *RefreshNotFoundResponseBody

NewRefreshNotFoundResponseBody builds the HTTP response body from the result of the "Refresh" endpoint of the "catalog" service.

type RefreshResponseBody

type RefreshResponseBody struct {
	// id of the job
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of the catalog
	CatalogName string `form:"catalogName" json:"catalogName" xml:"catalogName"`
	// status of the job
	Status string `form:"status" json:"status" xml:"status"`
}

RefreshResponseBody is the type of the "catalog" service "Refresh" endpoint HTTP response body.

func NewRefreshResponseBody

func NewRefreshResponseBody(res *catalogviews.JobView) *RefreshResponseBody

NewRefreshResponseBody builds the HTTP response body from the result of the "Refresh" endpoint of the "catalog" service.

type Server

type Server struct {
	Mounts       []*MountPoint
	Refresh      http.Handler
	RefreshAll   http.Handler
	CatalogError http.Handler
	CORS         http.Handler
}

Server lists the catalog service endpoint HTTP handlers.

func New

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