server

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByCatalogKindNameResourcePath added in v1.7.2

func ByCatalogKindNameResourcePath(catalog string, kind string, name string) string

ByCatalogKindNameResourcePath returns the URL path to the resource service ByCatalogKindName HTTP endpoint.

func ByCatalogKindNameVersionResourcePath added in v1.7.2

func ByCatalogKindNameVersionResourcePath(catalog string, kind string, name string, version string) string

ByCatalogKindNameVersionResourcePath returns the URL path to the resource service ByCatalogKindNameVersion HTTP endpoint.

func ByIDResourcePath added in v1.7.2

func ByIDResourcePath(id uint) string

ByIDResourcePath returns the URL path to the resource service ById HTTP endpoint.

func ByVersionIDResourcePath added in v1.7.2

func ByVersionIDResourcePath(versionID uint) string

ByVersionIDResourcePath returns the URL path to the resource service ByVersionId HTTP endpoint.

func DecodeByCatalogKindNameRequest added in v1.7.2

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

DecodeByCatalogKindNameRequest returns a decoder for requests sent to the resource ByCatalogKindName endpoint.

func DecodeByCatalogKindNameVersionRequest added in v1.7.2

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

DecodeByCatalogKindNameVersionRequest returns a decoder for requests sent to the resource ByCatalogKindNameVersion endpoint.

func DecodeByIDRequest added in v1.7.2

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

DecodeByIDRequest returns a decoder for requests sent to the resource ById endpoint.

func DecodeByVersionIDRequest added in v1.7.2

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

DecodeByVersionIDRequest returns a decoder for requests sent to the resource ByVersionId endpoint.

func DecodeQueryRequest added in v1.7.2

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

DecodeQueryRequest returns a decoder for requests sent to the resource Query endpoint.

func DecodeVersionsByIDRequest

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

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

func EncodeByCatalogKindNameResponse added in v1.7.2

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

EncodeByCatalogKindNameResponse returns an encoder for responses returned by the resource ByCatalogKindName endpoint.

func EncodeByCatalogKindNameVersionResponse added in v1.7.2

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

EncodeByCatalogKindNameVersionResponse returns an encoder for responses returned by the resource ByCatalogKindNameVersion endpoint.

func EncodeByIDResponse added in v1.7.2

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

EncodeByIDResponse returns an encoder for responses returned by the resource ById endpoint.

func EncodeByVersionIDResponse added in v1.7.2

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

EncodeByVersionIDResponse returns an encoder for responses returned by the resource ByVersionId endpoint.

func EncodeQueryResponse added in v1.7.2

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

EncodeQueryResponse returns an encoder for responses returned by the resource Query endpoint.

func EncodeVersionsByIDResponse

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

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

func HandleResourceOrigin added in v1.8.0

func HandleResourceOrigin(h http.Handler) http.Handler

HandleResourceOrigin applies the CORS response headers corresponding to the origin for the service resource.

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 MountByCatalogKindNameHandler added in v1.7.2

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

MountByCatalogKindNameHandler configures the mux to serve the "resource" service "ByCatalogKindName" endpoint.

func MountByCatalogKindNameVersionHandler added in v1.7.2

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

MountByCatalogKindNameVersionHandler configures the mux to serve the "resource" service "ByCatalogKindNameVersion" endpoint.

func MountByIDHandler added in v1.7.2

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

MountByIDHandler configures the mux to serve the "resource" service "ById" endpoint.

func MountByVersionIDHandler added in v1.7.2

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

MountByVersionIDHandler configures the mux to serve the "resource" service "ByVersionId" endpoint.

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 MountQueryHandler added in v1.7.2

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

MountQueryHandler configures the mux to serve the "resource" service "Query" endpoint.

func MountVersionsByIDHandler

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

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

func NewByCatalogKindNameHandler added in v1.7.2

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

NewByCatalogKindNameHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "ByCatalogKindName" endpoint.

func NewByCatalogKindNamePayload added in v1.7.2

func NewByCatalogKindNamePayload(catalog string, kind string, name string, pipelinesversion *string) *resource.ByCatalogKindNamePayload

NewByCatalogKindNamePayload builds a resource service ByCatalogKindName endpoint payload.

func NewByCatalogKindNameVersionHandler added in v1.7.2

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

NewByCatalogKindNameVersionHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "ByCatalogKindNameVersion" endpoint.

func NewByCatalogKindNameVersionPayload added in v1.7.2

func NewByCatalogKindNameVersionPayload(catalog string, kind string, name string, version string) *resource.ByCatalogKindNameVersionPayload

NewByCatalogKindNameVersionPayload builds a resource service ByCatalogKindNameVersion endpoint payload.

func NewByIDHandler added in v1.7.2

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

NewByIDHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "ById" endpoint.

func NewByIDPayload added in v1.7.2

func NewByIDPayload(id uint) *resource.ByIDPayload

NewByIDPayload builds a resource service ById endpoint payload.

func NewByVersionIDHandler added in v1.7.2

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

NewByVersionIDHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "ByVersionId" endpoint.

func NewByVersionIDPayload added in v1.7.2

func NewByVersionIDPayload(versionID uint) *resource.ByVersionIDPayload

NewByVersionIDPayload builds a resource service ByVersionId endpoint payload.

func NewCORSHandler

func NewCORSHandler() http.Handler

NewCORSHandler creates a HTTP handler which returns a simple 204 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(ctx context.Context, err error) goahttp.Statuser,
) http.Handler

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

func NewQueryHandler added in v1.7.2

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

NewQueryHandler creates a HTTP handler which loads the HTTP request and calls the "resource" service "Query" endpoint.

func NewQueryPayload added in v1.7.2

func NewQueryPayload(name string, catalogs []string, categories []string, kinds []string, tags []string, platforms []string, limit uint, match string) *resource.QueryPayload

NewQueryPayload builds a resource service Query endpoint payload.

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(ctx context.Context, 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 QueryResourcePath added in v1.7.2

func QueryResourcePath() string

QueryResourcePath returns the URL path to the resource service Query HTTP endpoint.

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 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"`
	// Path of the api to get the raw yaml of resource from hub apiserver
	HubRawURLPath string `form:"hubRawURLPath" json:"hubRawURLPath" xml:"hubRawURLPath"`
	// 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 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"`
	// Path of the api to get the raw yaml of resource from hub apiserver
	HubRawURLPath string `form:"hubRawURLPath" json:"hubRawURLPath" xml:"hubRawURLPath"`
	// 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
	Query                    http.Handler
	List                     http.Handler
	VersionsByID             http.Handler
	ByCatalogKindNameVersion http.Handler
	ByVersionID              http.Handler
	ByCatalogKindName        http.Handler
	ByID                     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(ctx context.Context, 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) MethodNames added in v1.11.0

func (s *Server) MethodNames() []string

MethodNames returns the methods served.

func (*Server) Mount added in v1.8.0

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the resource 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 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.

Jump to

Keyboard shortcuts

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