server

package
v1.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeVersionsByIDRequest

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

DecodeVersionsByIDRequest returns a decoder for requests sent to the resource VersionsByID endpoint.

func EncodeVersionsByIDError

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

EncodeVersionsByIDError returns an encoder for errors returned by the VersionsByID resource endpoint.

func EncodeVersionsByIDResponse

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

EncodeVersionsByIDResponse returns an encoder for responses returned by the resource VersionsByID endpoint.

func ListResourcePath

func ListResourcePath() string

ListResourcePath returns the URL path to the resource service List HTTP endpoint.

func Mount

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

Mount configures the mux to serve the resource endpoints.

func MountCORSHandler

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

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

func MountListHandler

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

MountListHandler configures the mux to serve the "resource" service "List" endpoint.

func MountVersionsByIDHandler

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

MountVersionsByIDHandler configures the mux to serve the "resource" service "VersionsByID" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

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

func NewListHandler

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

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "List" endpoint.

func NewVersionsByIDHandler

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

NewVersionsByIDHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "VersionsByID" endpoint.

func NewVersionsByIDPayload

func NewVersionsByIDPayload(id uint) *resource.VersionsByIDPayload

NewVersionsByIDPayload builds a resource service VersionsByID endpoint payload.

func VersionsByIDResourcePath

func VersionsByIDResourcePath(id uint) string

VersionsByIDResourcePath returns the URL path to the resource service VersionsByID HTTP endpoint.

Types

type CatalogResponseBodyMin

type CatalogResponseBodyMin struct {
	// ID is the unique id of the catalog
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of catalog
	Name string `form:"name" json:"name" xml:"name"`
	// Type of catalog
	Type string `form:"type" json:"type" xml:"type"`
}

CatalogResponseBodyMin is used to define fields on response body types.

type CategoryResponseBody

type CategoryResponseBody struct {
	// ID is the unique id of the category
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of category
	Name string `form:"name" json:"name" xml:"name"`
}

CategoryResponseBody 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 ListResponseBody

type ListResponseBody struct {
	Data ResourceDataResponseBodyWithoutVersionCollection `form:"data" json:"data" xml:"data"`
}

ListResponseBody is the type of the "resource" service "List" endpoint HTTP response body.

func NewListResponseBody

func NewListResponseBody(res *resourceviews.ResourcesView) *ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "List" endpoint of the "resource" 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 PlatformResponseBody

type PlatformResponseBody struct {
	// ID is the unique id of platform
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of platform
	Name string `form:"name" json:"name" xml:"name"`
}

PlatformResponseBody is used to define fields on response body types.

type ResourceDataResponseBodyWithoutVersion

type ResourceDataResponseBodyWithoutVersion struct {
	// ID is the unique id of the resource
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of resource
	Name string `form:"name" json:"name" xml:"name"`
	// Type of catalog to which resource belongs
	Catalog *CatalogResponseBodyMin `form:"catalog" json:"catalog" xml:"catalog"`
	// Categories related to resource
	Categories []*CategoryResponseBody `form:"categories" json:"categories" xml:"categories"`
	// Kind of resource
	Kind string `form:"kind" json:"kind" xml:"kind"`
	// Url path of the resource in hub
	HubURLPath string `form:"hubURLPath" json:"hubURLPath" xml:"hubURLPath"`
	// Latest version of resource
	LatestVersion *ResourceVersionDataResponseBodyWithoutResource `form:"latestVersion" json:"latestVersion" xml:"latestVersion"`
	// Tags related to resource
	Tags []*TagResponseBody `form:"tags" json:"tags" xml:"tags"`
	// Platforms related to resource
	Platforms []*PlatformResponseBody `form:"platforms" json:"platforms" xml:"platforms"`
	// Rating of resource
	Rating float64 `form:"rating" json:"rating" xml:"rating"`
}

ResourceDataResponseBodyWithoutVersion is used to define fields on response body types.

type ResourceDataResponseBodyWithoutVersionCollection

type ResourceDataResponseBodyWithoutVersionCollection []*ResourceDataResponseBodyWithoutVersion

ResourceDataResponseBodyWithoutVersionCollection is used to define fields on response body types.

type ResourceVersionDataResponseBodyMin

type ResourceVersionDataResponseBodyMin struct {
	// ID is the unique id of resource's version
	ID uint `form:"id" json:"id" xml:"id"`
	// Version of resource
	Version string `form:"version" json:"version" xml:"version"`
	// Raw URL of resource's yaml file of the version
	RawURL string `form:"rawURL" json:"rawURL" xml:"rawURL"`
	// Web URL of resource's yaml file of the version
	WebURL string `form:"webURL" json:"webURL" xml:"webURL"`
	// Url path of the resource in hub
	HubURLPath string `form:"hubURLPath" json:"hubURLPath" xml:"hubURLPath"`
	// Platforms related to resource version
	Platforms []*PlatformResponseBody `form:"platforms" json:"platforms" xml:"platforms"`
}

ResourceVersionDataResponseBodyMin is used to define fields on response body types.

type ResourceVersionDataResponseBodyWithoutResource

type ResourceVersionDataResponseBodyWithoutResource struct {
	// ID is the unique id of resource's version
	ID uint `form:"id" json:"id" xml:"id"`
	// Version of resource
	Version string `form:"version" json:"version" xml:"version"`
	// Display name of version
	DisplayName string `form:"displayName" json:"displayName" xml:"displayName"`
	// Deprecation status of a version
	Deprecated *bool `form:"deprecated,omitempty" json:"deprecated,omitempty" xml:"deprecated,omitempty"`
	// Description of version
	Description string `form:"description" json:"description" xml:"description"`
	// Minimum pipelines version the resource's version is compatible with
	MinPipelinesVersion string `form:"minPipelinesVersion" json:"minPipelinesVersion" xml:"minPipelinesVersion"`
	// Raw URL of resource's yaml file of the version
	RawURL string `form:"rawURL" json:"rawURL" xml:"rawURL"`
	// Web URL of resource's yaml file of the version
	WebURL string `form:"webURL" json:"webURL" xml:"webURL"`
	// Url path of the resource in hub
	HubURLPath string `form:"hubURLPath" json:"hubURLPath" xml:"hubURLPath"`
	// Timestamp when version was last updated
	UpdatedAt string `form:"updatedAt" json:"updatedAt" xml:"updatedAt"`
	// Platforms related to resource version
	Platforms []*PlatformResponseBody `form:"platforms" json:"platforms" xml:"platforms"`
}

ResourceVersionDataResponseBodyWithoutResource is used to define fields on response body types.

type Server

type Server struct {
	Mounts       []*MountPoint
	List         http.Handler
	VersionsByID http.Handler
	CORS         http.Handler
}

Server lists the resource service endpoint HTTP handlers.

func New

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

type TagResponseBody struct {
	// ID is the unique id of tag
	ID uint `form:"id" json:"id" xml:"id"`
	// Name of tag
	Name string `form:"name" json:"name" xml:"name"`
}

TagResponseBody is used to define fields on response body types.

type VersionsByIDInternalErrorResponseBody

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

VersionsByIDInternalErrorResponseBody is the type of the "resource" service "VersionsByID" endpoint HTTP response body for the "internal-error" error.

func NewVersionsByIDInternalErrorResponseBody

func NewVersionsByIDInternalErrorResponseBody(res *goa.ServiceError) *VersionsByIDInternalErrorResponseBody

NewVersionsByIDInternalErrorResponseBody builds the HTTP response body from the result of the "VersionsByID" endpoint of the "resource" service.

type VersionsByIDNotFoundResponseBody

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

VersionsByIDNotFoundResponseBody is the type of the "resource" service "VersionsByID" endpoint HTTP response body for the "not-found" error.

func NewVersionsByIDNotFoundResponseBody

func NewVersionsByIDNotFoundResponseBody(res *goa.ServiceError) *VersionsByIDNotFoundResponseBody

NewVersionsByIDNotFoundResponseBody builds the HTTP response body from the result of the "VersionsByID" endpoint of the "resource" service.

type VersionsByIDResponseBody

type VersionsByIDResponseBody struct {
	Data *VersionsResponseBody `form:"data" json:"data" xml:"data"`
}

VersionsByIDResponseBody is the type of the "resource" service "VersionsByID" endpoint HTTP response body.

func NewVersionsByIDResponseBody

func NewVersionsByIDResponseBody(res *resourceviews.ResourceVersionsView) *VersionsByIDResponseBody

NewVersionsByIDResponseBody builds the HTTP response body from the result of the "VersionsByID" endpoint of the "resource" service.

type VersionsResponseBody

type VersionsResponseBody struct {
	// Latest Version of resource
	Latest *ResourceVersionDataResponseBodyMin `form:"latest" json:"latest" xml:"latest"`
	// List of all versions of resource
	Versions []*ResourceVersionDataResponseBodyMin `form:"versions" json:"versions" xml:"versions"`
}

VersionsResponseBody is used to define fields on response body types.

Jump to

Keyboard shortcuts

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