server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateVolumesPath

func CreateVolumesPath() string

CreateVolumesPath returns the URL path to the volumes service create HTTP endpoint.

func DecodeCreateRequest

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

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

func DecodeDeleteRequest

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

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

func DecodeGetRequest

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

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

func DecodeListRequest

func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*volumes.ListPayload, error)

DecodeListRequest returns a decoder for requests sent to the volumes list endpoint.

func DeleteVolumesPath

func DeleteVolumesPath(name string) string

DeleteVolumesPath returns the URL path to the volumes service delete HTTP endpoint.

func EncodeCreateError

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

EncodeCreateError returns an encoder for errors returned by the create volumes 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 volumes create endpoint.

func EncodeDeleteError

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

EncodeDeleteError returns an encoder for errors returned by the delete volumes 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 volumes delete endpoint.

func EncodeGetError

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

EncodeGetError returns an encoder for errors returned by the get volumes 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 volumes get endpoint.

func EncodeListResponse

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

EncodeListResponse returns an encoder for responses returned by the volumes list endpoint.

func GetVolumesPath

func GetVolumesPath(name string) string

GetVolumesPath returns the URL path to the volumes service get HTTP endpoint.

func ListVolumesPath

func ListVolumesPath() string

ListVolumesPath returns the URL path to the volumes service list HTTP endpoint.

func Mount

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

Mount configures the mux to serve the volumes endpoints.

func MountCreateHandler

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

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

func MountDeleteHandler

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

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

func MountGetHandler

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

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

func MountListHandler

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

MountListHandler configures the mux to serve the "volumes" service "list" 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 "volumes" service "create" endpoint.

func NewCreateVolumePayload

func NewCreateVolumePayload(body *CreateRequestBody) *volumes.CreateVolumePayload

NewCreateVolumePayload builds a volumes 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 "volumes" service "delete" endpoint.

func NewDeletePayload

func NewDeletePayload(name string, namespace string) *volumes.DeletePayload

NewDeletePayload builds a volumes 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 "volumes" service "get" endpoint.

func NewGetPayload

func NewGetPayload(name string, namespace string) *volumes.GetPayload

NewGetPayload builds a volumes service get endpoint payload.

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 "volumes" service "list" endpoint.

func NewListPayload

func NewListPayload(namespace string) *volumes.ListPayload

NewListPayload builds a volumes service list endpoint payload.

func ValidateCreateRequestBody

func ValidateCreateRequestBody(body *CreateRequestBody) (err error)

ValidateCreateRequestBody runs the validations defined on CreateRequestBody

Types

type CreateRequestBody

type CreateRequestBody struct {
	// Volume type: container PVC or reusable CDI blank VM disk
	Type *string `form:"type,omitempty" json:"type,omitempty" xml:"type,omitempty"`
	// PVC name
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Target namespace
	Namespace *string `form:"namespace,omitempty" json:"namespace,omitempty" xml:"namespace,omitempty"`
	// Storage size
	Size *string `form:"size,omitempty" json:"size,omitempty" xml:"size,omitempty"`
	// Storage class name
	StorageClass *string `form:"storage_class,omitempty" json:"storage_class,omitempty" xml:"storage_class,omitempty"`
	// Access mode
	AccessMode *string `form:"access_mode,omitempty" json:"access_mode,omitempty" xml:"access_mode,omitempty"`
}

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

type CreateResponseBody

type CreateResponseBody struct {
	// Volume type: pvc or vm-disk
	Type string `form:"type" json:"type" xml:"type"`
	// PVC name
	Name string `form:"name" json:"name" xml:"name"`
	// Kubernetes namespace
	Namespace string `form:"namespace" json:"namespace" xml:"namespace"`
	// Storage size
	Size string `form:"size" json:"size" xml:"size"`
	// Storage class
	StorageClass *string `form:"storage_class,omitempty" json:"storage_class,omitempty" xml:"storage_class,omitempty"`
	// Access mode
	AccessMode *string `form:"access_mode,omitempty" json:"access_mode,omitempty" xml:"access_mode,omitempty"`
	// PVC phase (Bound, Pending, etc.)
	Phase string `form:"phase" json:"phase" xml:"phase"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
	// Kubernetes labels on the PVC
	Labels map[string]string `form:"labels,omitempty" json:"labels,omitempty" xml:"labels,omitempty"`
}

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

func NewCreateResponseBody

func NewCreateResponseBody(res *volumesviews.VolumeView) *CreateResponseBody

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

type GetResponseBody

type GetResponseBody struct {
	// Volume type: pvc or vm-disk
	Type string `form:"type" json:"type" xml:"type"`
	// PVC name
	Name string `form:"name" json:"name" xml:"name"`
	// Kubernetes namespace
	Namespace string `form:"namespace" json:"namespace" xml:"namespace"`
	// Storage size
	Size string `form:"size" json:"size" xml:"size"`
	// Storage class
	StorageClass *string `form:"storage_class,omitempty" json:"storage_class,omitempty" xml:"storage_class,omitempty"`
	// Access mode
	AccessMode *string `form:"access_mode,omitempty" json:"access_mode,omitempty" xml:"access_mode,omitempty"`
	// PVC phase (Bound, Pending, etc.)
	Phase string `form:"phase" json:"phase" xml:"phase"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
	// Kubernetes labels on the PVC
	Labels map[string]string `form:"labels,omitempty" json:"labels,omitempty" xml:"labels,omitempty"`
}

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

func NewGetResponseBody

func NewGetResponseBody(res *volumesviews.VolumeView) *GetResponseBody

NewGetResponseBody builds the HTTP response body from the result of the "get" endpoint of the "volumes" service.

type ListResponseBody

type ListResponseBody []*VolumeResponse

ListResponseBody is the type of the "volumes" service "list" endpoint HTTP response body.

func NewListResponseBody

func NewListResponseBody(res []*volumes.Volume) ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "list" endpoint of the "volumes" 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
	List   http.Handler
	Get    http.Handler
	Create http.Handler
	Delete http.Handler
}

Server lists the volumes service endpoint HTTP handlers.

func New

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

type VolumeResponse struct {
	// Volume type: pvc or vm-disk
	Type string `form:"type" json:"type" xml:"type"`
	// PVC name
	Name string `form:"name" json:"name" xml:"name"`
	// Kubernetes namespace
	Namespace string `form:"namespace" json:"namespace" xml:"namespace"`
	// Storage size
	Size string `form:"size" json:"size" xml:"size"`
	// Storage class
	StorageClass *string `form:"storage_class,omitempty" json:"storage_class,omitempty" xml:"storage_class,omitempty"`
	// Access mode
	AccessMode *string `form:"access_mode,omitempty" json:"access_mode,omitempty" xml:"access_mode,omitempty"`
	// PVC phase (Bound, Pending, etc.)
	Phase string `form:"phase" json:"phase" xml:"phase"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
	// Kubernetes labels on the PVC
	Labels map[string]string `form:"labels,omitempty" json:"labels,omitempty" xml:"labels,omitempty"`
}

VolumeResponse 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