server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccountPath

func CreateAccountPath() string

CreateAccountPath returns the URL path to the account service create HTTP endpoint.

func DecodeCreateRequest

func DecodeCreateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeCreateRequest returns a decoder for requests sent to the account create endpoint.

func DecodeDeleteRequest

func DecodeDeleteRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeDeleteRequest returns a decoder for requests sent to the account delete endpoint.

func DecodeGetRequest

func DecodeGetRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeGetRequest returns a decoder for requests sent to the account get endpoint.

func DecodeGroupAddRequest

func DecodeGroupAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeGroupAddRequest returns a decoder for requests sent to the account groupAdd endpoint.

func DecodeGroupRemoveRequest

func DecodeGroupRemoveRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeGroupRemoveRequest returns a decoder for requests sent to the account groupRemove endpoint.

func DecodeUpdateRequest

func DecodeUpdateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error)

DecodeUpdateRequest returns a decoder for requests sent to the account update endpoint.

func DeleteAccountPath

func DeleteAccountPath(accountID string) string

DeleteAccountPath returns the URL path to the account service delete HTTP endpoint.

func EncodeCreateResponse

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

EncodeCreateResponse returns an encoder for responses returned by the account create endpoint.

func EncodeDeleteResponse

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

EncodeDeleteResponse returns an encoder for responses returned by the account delete endpoint.

func EncodeGetResponse

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

EncodeGetResponse returns an encoder for responses returned by the account get endpoint.

func EncodeGroupAddResponse

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

EncodeGroupAddResponse returns an encoder for responses returned by the account groupAdd endpoint.

func EncodeGroupRemoveResponse

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

EncodeGroupRemoveResponse returns an encoder for responses returned by the account groupRemove endpoint.

func EncodeUpdateError

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

EncodeUpdateError returns an encoder for errors returned by the update account endpoint.

func EncodeUpdateResponse

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

EncodeUpdateResponse returns an encoder for responses returned by the account update endpoint.

func GetAccountPath

func GetAccountPath(accountID string) string

GetAccountPath returns the URL path to the account service get HTTP endpoint.

func GroupAddAccountPath

func GroupAddAccountPath(accountID string, groupID string) string

GroupAddAccountPath returns the URL path to the account service groupAdd HTTP endpoint.

func GroupRemoveAccountPath

func GroupRemoveAccountPath(accountID string, groupID string) string

GroupRemoveAccountPath returns the URL path to the account service groupRemove HTTP endpoint.

func Mount

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

Mount configures the mux to serve the account endpoints.

func MountCreateHandler

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

MountCreateHandler configures the mux to serve the "account" service "create" endpoint.

func MountDeleteHandler

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

MountDeleteHandler configures the mux to serve the "account" service "delete" endpoint.

func MountGetHandler

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

MountGetHandler configures the mux to serve the "account" service "get" endpoint.

func MountGroupAddHandler

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

MountGroupAddHandler configures the mux to serve the "account" service "groupAdd" endpoint.

func MountGroupRemoveHandler

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

MountGroupRemoveHandler configures the mux to serve the "account" service "groupRemove" endpoint.

func MountUpdateHandler

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

MountUpdateHandler configures the mux to serve the "account" service "update" endpoint.

func NewCreateHandler

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

NewCreateHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "create" endpoint.

func NewCreatePayload

func NewCreatePayload(body *CreateRequestBody) *account.CreatePayload

NewCreatePayload builds a account service create endpoint payload.

func NewDeleteHandler

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

NewDeleteHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "delete" endpoint.

func NewDeletePayload

func NewDeletePayload(accountID string) *account.DeletePayload

NewDeletePayload builds a account service delete endpoint payload.

func NewGetHandler

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

NewGetHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "get" endpoint.

func NewGetPayload

func NewGetPayload(accountID string) *account.GetPayload

NewGetPayload builds a account service get endpoint payload.

func NewGroupAddHandler

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

NewGroupAddHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "groupAdd" endpoint.

func NewGroupAddPayload

func NewGroupAddPayload(accountID string, groupID string) *account.GroupAddPayload

NewGroupAddPayload builds a account service groupAdd endpoint payload.

func NewGroupRemoveHandler

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

NewGroupRemoveHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "groupRemove" endpoint.

func NewGroupRemovePayload

func NewGroupRemovePayload(accountID string, groupID string) *account.GroupRemovePayload

NewGroupRemovePayload builds a account service groupRemove endpoint payload.

func NewUpdateHandler

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

NewUpdateHandler creates a HTTP handler which loads the HTTP request and calls the "account" service "update" endpoint.

func NewUpdatePayload

func NewUpdatePayload(body *UpdateRequestBody, accountID string) *account.UpdatePayload

NewUpdatePayload builds a account service update endpoint payload.

func UpdateAccountPath

func UpdateAccountPath(accountID string) string

UpdateAccountPath returns the URL path to the account service update HTTP endpoint.

func ValidateCreateRequestBody

func ValidateCreateRequestBody(body *CreateRequestBody) (err error)

ValidateCreateRequestBody runs the validations defined on CreateRequestBody

func ValidateUpdateRequestBody

func ValidateUpdateRequestBody(body *UpdateRequestBody) (err error)

ValidateUpdateRequestBody runs the validations defined on UpdateRequestBody

Types

type CreateRequestBody

type CreateRequestBody struct {
	// Name of user
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Login of user
	Login *string `form:"login,omitempty" json:"login,omitempty" xml:"login,omitempty"`
	// Email of user
	Email *string `form:"email,omitempty" json:"email,omitempty" xml:"email,omitempty"`
}

CreateRequestBody is the type of the "account" service "create" endpoint HTTP request body.

type CreateResponseBody

type CreateResponseBody struct {
	// Temporary account identifier
	ID *int64 `gorm:"autoIncrement" json:"id,omitempty"`
	// IDP account identifier
	GUID *string `json:"guid,omitempty"`
	// Name of user
	Name string `form:"name" json:"name" xml:"name"`
	// Login of user
	Login string `gorm:"uniqueIndex" json:"login"`
	// Email of user
	Email string `form:"email" json:"email" xml:"email"`
	// Status of account
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}

CreateResponseBody is the type of the "account" service "create" endpoint HTTP response body.

func NewCreateResponseBody

func NewCreateResponseBody(res *account.Account) *CreateResponseBody

NewCreateResponseBody builds the HTTP response body from the result of the "create" endpoint of the "account" service.

type GetResponseBody

type GetResponseBody struct {
	// Temporary account identifier
	ID *int64 `gorm:"autoIncrement" json:"id,omitempty"`
	// IDP account identifier
	GUID *string `json:"guid,omitempty"`
	// Name of user
	Name string `form:"name" json:"name" xml:"name"`
	// Login of user
	Login string `gorm:"uniqueIndex" json:"login"`
	// Email of user
	Email string `form:"email" json:"email" xml:"email"`
	// Status of account
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}

GetResponseBody is the type of the "account" service "get" endpoint HTTP response body.

func NewGetResponseBody

func NewGetResponseBody(res *account.Account) *GetResponseBody

NewGetResponseBody builds the HTTP response body from the result of the "get" endpoint of the "account" 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
	Create      http.Handler
	Get         http.Handler
	Update      http.Handler
	Delete      http.Handler
	GroupAdd    http.Handler
	GroupRemove http.Handler
}

Server lists the account service endpoint HTTP handlers.

func New

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

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

UpdateNotImplementedResponseBody is the type of the "account" service "update" endpoint HTTP response body for the "NotImplemented" error.

func NewUpdateNotImplementedResponseBody

func NewUpdateNotImplementedResponseBody(res *goa.ServiceError) *UpdateNotImplementedResponseBody

NewUpdateNotImplementedResponseBody builds the HTTP response body from the result of the "update" endpoint of the "account" service.

type UpdateRequestBody

type UpdateRequestBody struct {
	// Status of user
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}

UpdateRequestBody is the type of the "account" service "update" endpoint HTTP request body.

type UpdateResponseBody

type UpdateResponseBody struct {
	// Temporary account identifier
	ID *int64 `gorm:"autoIncrement" json:"id,omitempty"`
	// IDP account identifier
	GUID *string `json:"guid,omitempty"`
	// Name of user
	Name string `form:"name" json:"name" xml:"name"`
	// Login of user
	Login string `gorm:"uniqueIndex" json:"login"`
	// Email of user
	Email string `form:"email" json:"email" xml:"email"`
	// Status of account
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}

UpdateResponseBody is the type of the "account" service "update" endpoint HTTP response body.

func NewUpdateResponseBody

func NewUpdateResponseBody(res *account.Account) *UpdateResponseBody

NewUpdateResponseBody builds the HTTP response body from the result of the "update" endpoint of the "account" service.

Jump to

Keyboard shortcuts

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