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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeRefreshConfigRequest

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

DecodeRefreshConfigRequest returns a decoder for requests sent to the admin RefreshConfig endpoint.

func DecodeUpdateAgentRequest

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

DecodeUpdateAgentRequest returns a decoder for requests sent to the admin UpdateAgent endpoint.

func EncodeRefreshConfigError

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

EncodeRefreshConfigError returns an encoder for errors returned by the RefreshConfig admin endpoint.

func EncodeRefreshConfigResponse

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

EncodeRefreshConfigResponse returns an encoder for responses returned by the admin RefreshConfig endpoint.

func EncodeUpdateAgentError

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

EncodeUpdateAgentError returns an encoder for errors returned by the UpdateAgent admin endpoint.

func EncodeUpdateAgentResponse

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

EncodeUpdateAgentResponse returns an encoder for responses returned by the admin UpdateAgent 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 MountRefreshConfigHandler

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

MountRefreshConfigHandler configures the mux to serve the "admin" service "RefreshConfig" endpoint.

func MountUpdateAgentHandler

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

MountUpdateAgentHandler configures the mux to serve the "admin" service "UpdateAgent" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

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

func NewRefreshConfigHandler

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

NewRefreshConfigHandler creates a HTTP handler which loads the HTTP request and calls the "admin" service "RefreshConfig" endpoint.

func NewRefreshConfigPayload

func NewRefreshConfigPayload(token string) *admin.RefreshConfigPayload

NewRefreshConfigPayload builds a admin service RefreshConfig endpoint payload.

func NewUpdateAgentHandler

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

NewUpdateAgentHandler creates a HTTP handler which loads the HTTP request and calls the "admin" service "UpdateAgent" endpoint.

func NewUpdateAgentPayload

func NewUpdateAgentPayload(body *UpdateAgentRequestBody, token string) *admin.UpdateAgentPayload

NewUpdateAgentPayload builds a admin service UpdateAgent endpoint payload.

func RefreshConfigAdminPath

func RefreshConfigAdminPath() string

RefreshConfigAdminPath returns the URL path to the admin service RefreshConfig HTTP endpoint.

func UpdateAgentAdminPath

func UpdateAgentAdminPath() string

UpdateAgentAdminPath returns the URL path to the admin service UpdateAgent HTTP endpoint.

func ValidateUpdateAgentRequestBody

func ValidateUpdateAgentRequestBody(body *UpdateAgentRequestBody) (err error)

ValidateUpdateAgentRequestBody runs the validations defined on UpdateAgentRequestBody

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 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 RefreshConfigInternalErrorResponseBody

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

RefreshConfigInternalErrorResponseBody is the type of the "admin" service "RefreshConfig" endpoint HTTP response body for the "internal-error" error.

func NewRefreshConfigInternalErrorResponseBody

func NewRefreshConfigInternalErrorResponseBody(res *goa.ServiceError) *RefreshConfigInternalErrorResponseBody

NewRefreshConfigInternalErrorResponseBody builds the HTTP response body from the result of the "RefreshConfig" endpoint of the "admin" service.

type RefreshConfigInvalidScopesResponseBody

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

RefreshConfigInvalidScopesResponseBody is the type of the "admin" service "RefreshConfig" endpoint HTTP response body for the "invalid-scopes" error.

func NewRefreshConfigInvalidScopesResponseBody

func NewRefreshConfigInvalidScopesResponseBody(res *goa.ServiceError) *RefreshConfigInvalidScopesResponseBody

NewRefreshConfigInvalidScopesResponseBody builds the HTTP response body from the result of the "RefreshConfig" endpoint of the "admin" service.

type RefreshConfigInvalidTokenResponseBody

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

RefreshConfigInvalidTokenResponseBody is the type of the "admin" service "RefreshConfig" endpoint HTTP response body for the "invalid-token" error.

func NewRefreshConfigInvalidTokenResponseBody

func NewRefreshConfigInvalidTokenResponseBody(res *goa.ServiceError) *RefreshConfigInvalidTokenResponseBody

NewRefreshConfigInvalidTokenResponseBody builds the HTTP response body from the result of the "RefreshConfig" endpoint of the "admin" service.

type RefreshConfigResponseBody

type RefreshConfigResponseBody struct {
	// Config file checksum
	Checksum string `form:"checksum" json:"checksum" xml:"checksum"`
}

RefreshConfigResponseBody is the type of the "admin" service "RefreshConfig" endpoint HTTP response body.

func NewRefreshConfigResponseBody

func NewRefreshConfigResponseBody(res *admin.RefreshConfigResult) *RefreshConfigResponseBody

NewRefreshConfigResponseBody builds the HTTP response body from the result of the "RefreshConfig" endpoint of the "admin" service.

type Server

type Server struct {
	Mounts        []*MountPoint
	UpdateAgent   http.Handler
	RefreshConfig 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(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) 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 UpdateAgentInternalErrorResponseBody

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

UpdateAgentInternalErrorResponseBody is the type of the "admin" service "UpdateAgent" endpoint HTTP response body for the "internal-error" error.

func NewUpdateAgentInternalErrorResponseBody

func NewUpdateAgentInternalErrorResponseBody(res *goa.ServiceError) *UpdateAgentInternalErrorResponseBody

NewUpdateAgentInternalErrorResponseBody builds the HTTP response body from the result of the "UpdateAgent" endpoint of the "admin" service.

type UpdateAgentInvalidPayloadResponseBody

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

UpdateAgentInvalidPayloadResponseBody is the type of the "admin" service "UpdateAgent" endpoint HTTP response body for the "invalid-payload" error.

func NewUpdateAgentInvalidPayloadResponseBody

func NewUpdateAgentInvalidPayloadResponseBody(res *goa.ServiceError) *UpdateAgentInvalidPayloadResponseBody

NewUpdateAgentInvalidPayloadResponseBody builds the HTTP response body from the result of the "UpdateAgent" endpoint of the "admin" service.

type UpdateAgentInvalidScopesResponseBody

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

UpdateAgentInvalidScopesResponseBody is the type of the "admin" service "UpdateAgent" endpoint HTTP response body for the "invalid-scopes" error.

func NewUpdateAgentInvalidScopesResponseBody

func NewUpdateAgentInvalidScopesResponseBody(res *goa.ServiceError) *UpdateAgentInvalidScopesResponseBody

NewUpdateAgentInvalidScopesResponseBody builds the HTTP response body from the result of the "UpdateAgent" endpoint of the "admin" service.

type UpdateAgentInvalidTokenResponseBody

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

UpdateAgentInvalidTokenResponseBody is the type of the "admin" service "UpdateAgent" endpoint HTTP response body for the "invalid-token" error.

func NewUpdateAgentInvalidTokenResponseBody

func NewUpdateAgentInvalidTokenResponseBody(res *goa.ServiceError) *UpdateAgentInvalidTokenResponseBody

NewUpdateAgentInvalidTokenResponseBody builds the HTTP response body from the result of the "UpdateAgent" endpoint of the "admin" service.

type UpdateAgentRequestBody

type UpdateAgentRequestBody struct {
	// Name of Agent
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Scopes required for Agent
	Scopes []string `form:"scopes,omitempty" json:"scopes,omitempty" xml:"scopes,omitempty"`
}

UpdateAgentRequestBody is the type of the "admin" service "UpdateAgent" endpoint HTTP request body.

type UpdateAgentResponseBody

type UpdateAgentResponseBody struct {
	// Agent JWT
	Token string `form:"token" json:"token" xml:"token"`
}

UpdateAgentResponseBody is the type of the "admin" service "UpdateAgent" endpoint HTTP response body.

func NewUpdateAgentResponseBody

func NewUpdateAgentResponseBody(res *admin.UpdateAgentResult) *UpdateAgentResponseBody

NewUpdateAgentResponseBody builds the HTTP response body from the result of the "UpdateAgent" endpoint of the "admin" service.

Jump to

Keyboard shortcuts

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