server

package
v0.0.0-...-882aa90 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeHealthEndpointRequest

func DecodeHealthEndpointRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*admin.HealthPayload, error)

DecodeHealthEndpointRequest returns a decoder for requests sent to the admin health endpoint.

func DecodeUploadBackupRequest

func DecodeUploadBackupRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*admin.UploadBackupPayload, error)

DecodeUploadBackupRequest returns a decoder for requests sent to the admin upload backup endpoint.

func EncodeHealthEndpointError

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

EncodeHealthEndpointError returns an encoder for errors returned by the health admin endpoint.

func EncodeHealthEndpointResponse

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

EncodeHealthEndpointResponse returns an encoder for responses returned by the admin health endpoint.

func EncodeUploadBackupError

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

EncodeUploadBackupError returns an encoder for errors returned by the upload backup admin endpoint.

func EncodeUploadBackupResponse

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

EncodeUploadBackupResponse returns an encoder for responses returned by the admin upload backup endpoint.

func HealthEndpointAdminPath

func HealthEndpointAdminPath() string

HealthEndpointAdminPath returns the URL path to the admin service health HTTP endpoint.

func Mount

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

Mount configures the mux to serve the admin endpoints.

func MountCORSHandler

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

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

func MountHealthEndpointHandler

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

MountHealthEndpointHandler configures the mux to serve the "admin" service "health" endpoint.

func MountUploadBackupHandler

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

MountUploadBackupHandler configures the mux to serve the "admin" service "upload backup" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

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

func NewHealthEndpointHandler

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

NewHealthEndpointHandler creates a HTTP handler which loads the HTTP request and calls the "admin" service "health" endpoint.

func NewHealthPayload

func NewHealthPayload(auth string) *admin.HealthPayload

NewHealthPayload builds a admin service health endpoint payload.

func NewUploadBackupHandler

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

NewUploadBackupHandler creates a HTTP handler which loads the HTTP request and calls the "admin" service "upload backup" endpoint.

func NewUploadBackupPayload

func NewUploadBackupPayload(contentType string, contentLength int64, auth string) *admin.UploadBackupPayload

NewUploadBackupPayload builds a admin service upload backup endpoint payload.

func UploadBackupAdminPath

func UploadBackupAdminPath() string

UploadBackupAdminPath returns the URL path to the admin service upload backup HTTP endpoint.

Types

type HealthBadRequestResponseBody

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

HealthBadRequestResponseBody is the type of the "admin" service "health" endpoint HTTP response body for the "bad-request" error.

func NewHealthBadRequestResponseBody

func NewHealthBadRequestResponseBody(res *goa.ServiceError) *HealthBadRequestResponseBody

NewHealthBadRequestResponseBody builds the HTTP response body from the result of the "health" endpoint of the "admin" service.

type HealthForbiddenResponseBody

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

HealthForbiddenResponseBody is the type of the "admin" service "health" endpoint HTTP response body for the "forbidden" error.

func NewHealthForbiddenResponseBody

func NewHealthForbiddenResponseBody(res *goa.ServiceError) *HealthForbiddenResponseBody

NewHealthForbiddenResponseBody builds the HTTP response body from the result of the "health" endpoint of the "admin" service.

type HealthNotFoundResponseBody

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

HealthNotFoundResponseBody is the type of the "admin" service "health" endpoint HTTP response body for the "not-found" error.

func NewHealthNotFoundResponseBody

func NewHealthNotFoundResponseBody(res *goa.ServiceError) *HealthNotFoundResponseBody

NewHealthNotFoundResponseBody builds the HTTP response body from the result of the "health" endpoint of the "admin" service.

type HealthResponseBody

type HealthResponseBody struct {
	Queue *QueueHealthResponseBody `form:"queue" json:"queue" xml:"queue"`
}

HealthResponseBody is the type of the "admin" service "health" endpoint HTTP response body.

func NewHealthResponseBody

func NewHealthResponseBody(res *adminviews.HealthView) *HealthResponseBody

NewHealthResponseBody builds the HTTP response body from the result of the "health" endpoint of the "admin" service.

type HealthUnauthorizedResponseBody

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

HealthUnauthorizedResponseBody is the type of the "admin" service "health" endpoint HTTP response body for the "unauthorized" error.

func NewHealthUnauthorizedResponseBody

func NewHealthUnauthorizedResponseBody(res *goa.ServiceError) *HealthUnauthorizedResponseBody

NewHealthUnauthorizedResponseBody builds the HTTP response body from the result of the "health" endpoint of the "admin" 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 QueueHealthResponseBody

type QueueHealthResponseBody struct {
	Pending int64 `form:"pending" json:"pending" xml:"pending"`
	Errors  int64 `form:"errors" json:"errors" xml:"errors"`
}

QueueHealthResponseBody is used to define fields on response body types.

type Server

type Server struct {
	Mounts         []*MountPoint
	HealthEndpoint http.Handler
	UploadBackup   http.Handler
	CORS           http.Handler
}

Server lists the admin service endpoint HTTP handlers.

func New

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

type UploadBackupBadRequestResponseBody

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

UploadBackupBadRequestResponseBody is the type of the "admin" service "upload backup" endpoint HTTP response body for the "bad-request" error.

func NewUploadBackupBadRequestResponseBody

func NewUploadBackupBadRequestResponseBody(res *goa.ServiceError) *UploadBackupBadRequestResponseBody

NewUploadBackupBadRequestResponseBody builds the HTTP response body from the result of the "upload backup" endpoint of the "admin" service.

type UploadBackupForbiddenResponseBody

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

UploadBackupForbiddenResponseBody is the type of the "admin" service "upload backup" endpoint HTTP response body for the "forbidden" error.

func NewUploadBackupForbiddenResponseBody

func NewUploadBackupForbiddenResponseBody(res *goa.ServiceError) *UploadBackupForbiddenResponseBody

NewUploadBackupForbiddenResponseBody builds the HTTP response body from the result of the "upload backup" endpoint of the "admin" service.

type UploadBackupNotFoundResponseBody

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

UploadBackupNotFoundResponseBody is the type of the "admin" service "upload backup" endpoint HTTP response body for the "not-found" error.

func NewUploadBackupNotFoundResponseBody

func NewUploadBackupNotFoundResponseBody(res *goa.ServiceError) *UploadBackupNotFoundResponseBody

NewUploadBackupNotFoundResponseBody builds the HTTP response body from the result of the "upload backup" endpoint of the "admin" service.

type UploadBackupResponseBody

type UploadBackupResponseBody struct {
	DeviceName   *string  `form:"deviceName,omitempty" json:"deviceName,omitempty" xml:"deviceName,omitempty"`
	DeviceID     *string  `form:"deviceId,omitempty" json:"deviceId,omitempty" xml:"deviceId,omitempty"`
	GenerationID *string  `form:"generationId,omitempty" json:"generationId,omitempty" xml:"generationId,omitempty"`
	Records      []int32  `form:"records,omitempty" json:"records,omitempty" xml:"records,omitempty"`
	Errors       []string `form:"errors" json:"errors" xml:"errors"`
}

UploadBackupResponseBody is the type of the "admin" service "upload backup" endpoint HTTP response body.

func NewUploadBackupResponseBody

func NewUploadBackupResponseBody(res *adminviews.BackupCheckView) *UploadBackupResponseBody

NewUploadBackupResponseBody builds the HTTP response body from the result of the "upload backup" endpoint of the "admin" service.

type UploadBackupUnauthorizedResponseBody

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

UploadBackupUnauthorizedResponseBody is the type of the "admin" service "upload backup" endpoint HTTP response body for the "unauthorized" error.

func NewUploadBackupUnauthorizedResponseBody

func NewUploadBackupUnauthorizedResponseBody(res *goa.ServiceError) *UploadBackupUnauthorizedResponseBody

NewUploadBackupUnauthorizedResponseBody builds the HTTP response body from the result of the "upload backup" endpoint of the "admin" service.

Jump to

Keyboard shortcuts

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