server

package
v0.0.0-...-69b4764 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeQueryPublishingStatusRequest

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

DecodeQueryPublishingStatusRequest returns a decoder for requests sent to the tiup query-publishing-status endpoint.

func DecodeRequestToPublishRequest

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

DecodeRequestToPublishRequest returns a decoder for requests sent to the tiup request-to-publish endpoint.

func EncodeQueryPublishingStatusResponse

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

EncodeQueryPublishingStatusResponse returns an encoder for responses returned by the tiup query-publishing-status endpoint.

func EncodeRequestToPublishResponse

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

EncodeRequestToPublishResponse returns an encoder for responses returned by the tiup request-to-publish endpoint.

func EncodeResetRateLimitResponse

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

EncodeResetRateLimitResponse returns an encoder for responses returned by the tiup reset-rate-limit endpoint.

func Mount

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

Mount configures the mux to serve the tiup endpoints.

func MountQueryPublishingStatusHandler

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

MountQueryPublishingStatusHandler configures the mux to serve the "tiup" service "query-publishing-status" endpoint.

func MountRequestToPublishHandler

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

MountRequestToPublishHandler configures the mux to serve the "tiup" service "request-to-publish" endpoint.

func MountResetRateLimitHandler

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

MountResetRateLimitHandler configures the mux to serve the "tiup" service "reset-rate-limit" endpoint.

func NewQueryPublishingStatusHandler

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

NewQueryPublishingStatusHandler creates a HTTP handler which loads the HTTP request and calls the "tiup" service "query-publishing-status" endpoint.

func NewQueryPublishingStatusPayload

func NewQueryPublishingStatusPayload(requestID string) *tiup.QueryPublishingStatusPayload

NewQueryPublishingStatusPayload builds a tiup service query-publishing-status endpoint payload.

func NewRequestToPublishHandler

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

NewRequestToPublishHandler creates a HTTP handler which loads the HTTP request and calls the "tiup" service "request-to-publish" endpoint.

func NewRequestToPublishPayload

func NewRequestToPublishPayload(body *RequestToPublishRequestBody) *tiup.RequestToPublishPayload

NewRequestToPublishPayload builds a tiup service request-to-publish endpoint payload.

func NewResetRateLimitHandler

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

NewResetRateLimitHandler creates a HTTP handler which loads the HTTP request and calls the "tiup" service "reset-rate-limit" endpoint.

func QueryPublishingStatusTiupPath

func QueryPublishingStatusTiupPath(requestID string) string

QueryPublishingStatusTiupPath returns the URL path to the tiup service query-publishing-status HTTP endpoint.

func RequestToPublishTiupPath

func RequestToPublishTiupPath() string

RequestToPublishTiupPath returns the URL path to the tiup service request-to-publish HTTP endpoint.

func ResetRateLimitTiupPath

func ResetRateLimitTiupPath() string

ResetRateLimitTiupPath returns the URL path to the tiup service reset-rate-limit HTTP endpoint.

func ValidateRequestToPublishRequestBody

func ValidateRequestToPublishRequestBody(body *RequestToPublishRequestBody) (err error)

ValidateRequestToPublishRequestBody runs the validations defined on Request-To-PublishRequestBody

Types

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 RequestToPublishRequestBody

type RequestToPublishRequestBody struct {
	// The full url of the pushed OCI artifact, contain the tag part. It will parse
	// the repo from it.
	ArtifactURL *string `form:"artifact_url,omitempty" json:"artifact_url,omitempty" xml:"artifact_url,omitempty"`
	// Force set the version. Default is the artifact version read from
	// `org.opencontainers.image.version` of the manifest config.
	Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"`
	// Staging is http://tiup.pingcap.net:8988, product is
	// http://tiup.pingcap.net:8987.
	TiupMirror *string `form:"tiup-mirror,omitempty" json:"tiup-mirror,omitempty" xml:"tiup-mirror,omitempty"`
	// The request id
	RequestID *string `form:"request_id,omitempty" json:"request_id,omitempty" xml:"request_id,omitempty"`
}

RequestToPublishRequestBody is the type of the "tiup" service "request-to-publish" endpoint HTTP request body.

type Server

type Server struct {
	Mounts                []*MountPoint
	RequestToPublish      http.Handler
	QueryPublishingStatus http.Handler
	ResetRateLimit        http.Handler
}

Server lists the tiup service endpoint HTTP handlers.

func New

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

Jump to

Keyboard shortcuts

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