Documentation
¶
Overview ¶
Code generated by ogen, DO NOT EDIT.
Index ¶
- type Envelope
- func (s *Envelope) Decode(d *jx.Decoder) error
- func (s *Envelope) Encode(e *jx.Encoder)
- func (s *Envelope) GetPayload() string
- func (s *Envelope) GetSignature() string
- func (s *Envelope) MarshalJSON() ([]byte, error)
- func (s *Envelope) SetPayload(val string)
- func (s *Envelope) SetSignature(val string)
- func (s *Envelope) UnmarshalJSON(data []byte) error
- type EnvelopeHeaders
- type ErrorHandler
- type GetListNotModified
- type GetListParams
- type GetListRes
- type Handler
- type Health
- func (s *Health) Decode(d *jx.Decoder) error
- func (s *Health) Encode(e *jx.Encoder)
- func (s *Health) GetGeneration() int64
- func (s *Health) GetLastSuccess() OptDateTime
- func (s *Health) GetStatus() HealthStatus
- func (s *Health) GetVersion() string
- func (s *Health) MarshalJSON() ([]byte, error)
- func (s *Health) SetGeneration(val int64)
- func (s *Health) SetLastSuccess(val OptDateTime)
- func (s *Health) SetStatus(val HealthStatus)
- func (s *Health) SetVersion(val string)
- func (s *Health) UnmarshalJSON(data []byte) error
- func (s *Health) Validate() error
- type HealthStatus
- func (HealthStatus) AllValues() []HealthStatus
- func (s *HealthStatus) Decode(d *jx.Decoder) error
- func (s HealthStatus) Encode(e *jx.Encoder)
- func (s HealthStatus) MarshalJSON() ([]byte, error)
- func (s HealthStatus) MarshalText() ([]byte, error)
- func (s *HealthStatus) UnmarshalJSON(data []byte) error
- func (s *HealthStatus) UnmarshalText(data []byte) error
- func (s HealthStatus) Validate() error
- type Middleware
- type OperationName
- type OptDateTime
- func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error
- func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))
- func (o OptDateTime) Get() (v time.Time, ok bool)
- func (o OptDateTime) IsSet() bool
- func (s OptDateTime) MarshalJSON() ([]byte, error)
- func (o OptDateTime) Or(d time.Time) time.Time
- func (o *OptDateTime) Reset()
- func (o *OptDateTime) SetTo(v time.Time)
- func (s *OptDateTime) UnmarshalJSON(data []byte) error
- type OptString
- func (o *OptString) Decode(d *jx.Decoder) error
- func (o OptString) Encode(e *jx.Encoder)
- func (o OptString) Get() (v string, ok bool)
- func (o OptString) IsSet() bool
- func (s OptString) MarshalJSON() ([]byte, error)
- func (o OptString) Or(d string) string
- func (o *OptString) Reset()
- func (o *OptString) SetTo(v string)
- func (s *OptString) UnmarshalJSON(data []byte) error
- type OptURI
- func (o *OptURI) Decode(d *jx.Decoder) error
- func (o OptURI) Encode(e *jx.Encoder)
- func (o OptURI) Get() (v url.URL, ok bool)
- func (o OptURI) IsSet() bool
- func (s OptURI) MarshalJSON() ([]byte, error)
- func (o OptURI) Or(d url.URL) url.URL
- func (o *OptURI) Reset()
- func (o *OptURI) SetTo(v url.URL)
- func (s *OptURI) UnmarshalJSON(data []byte) error
- type Option
- type Problem
- func (s *Problem) Decode(d *jx.Decoder) error
- func (s *Problem) Encode(e *jx.Encoder)
- func (s *Problem) GetDetail() OptString
- func (s *Problem) GetInstance() OptURI
- func (s *Problem) GetStatus() int
- func (s *Problem) GetTitle() string
- func (s *Problem) GetType() OptURI
- func (s *Problem) MarshalJSON() ([]byte, error)
- func (s *Problem) SetDetail(val OptString)
- func (s *Problem) SetInstance(val OptURI)
- func (s *Problem) SetStatus(val int)
- func (s *Problem) SetTitle(val string)
- func (s *Problem) SetType(val OptURI)
- func (s *Problem) UnmarshalJSON(data []byte) error
- func (s *Problem) Validate() error
- type ProblemStatusCode
- type Route
- type Server
- type ServerOption
- func WithErrorHandler(h ErrorHandler) ServerOption
- func WithMaxMultipartMemory(max int64) ServerOption
- func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
- func WithMiddleware(m ...Middleware) ServerOption
- func WithNotFound(notFound http.HandlerFunc) ServerOption
- func WithPathPrefix(prefix string) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
// Base64 (standard, padded) of the payload JSON bytes.
Payload string `json:"payload"`
// The armored OpenSSH signature (`-----BEGIN SSH SIGNATURE-----`) over the decoded payload bytes, in
// the configured namespace.
Signature string `json:"signature"`
}
Ref: #/components/schemas/Envelope
func (*Envelope) GetPayload ¶
GetPayload returns the value of Payload.
func (*Envelope) GetSignature ¶
GetSignature returns the value of Signature.
func (*Envelope) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Envelope) SetPayload ¶
SetPayload sets the value of Payload.
func (*Envelope) SetSignature ¶
SetSignature sets the value of Signature.
func (*Envelope) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type EnvelopeHeaders ¶
EnvelopeHeaders wraps Envelope with response headers.
func (*EnvelopeHeaders) GetCacheControl ¶
func (s *EnvelopeHeaders) GetCacheControl() string
GetCacheControl returns the value of CacheControl.
func (*EnvelopeHeaders) GetETag ¶
func (s *EnvelopeHeaders) GetETag() string
GetETag returns the value of ETag.
func (*EnvelopeHeaders) GetResponse ¶
func (s *EnvelopeHeaders) GetResponse() Envelope
GetResponse returns the value of Response.
func (*EnvelopeHeaders) SetCacheControl ¶
func (s *EnvelopeHeaders) SetCacheControl(val string)
SetCacheControl sets the value of CacheControl.
func (*EnvelopeHeaders) SetETag ¶
func (s *EnvelopeHeaders) SetETag(val string)
SetETag sets the value of ETag.
func (*EnvelopeHeaders) SetResponse ¶
func (s *EnvelopeHeaders) SetResponse(val Envelope)
SetResponse sets the value of Response.
type GetListNotModified ¶
GetListNotModified is response for GetList operation.
func (*GetListNotModified) GetCacheControl ¶
func (s *GetListNotModified) GetCacheControl() string
GetCacheControl returns the value of CacheControl.
func (*GetListNotModified) GetETag ¶
func (s *GetListNotModified) GetETag() string
GetETag returns the value of ETag.
func (*GetListNotModified) SetCacheControl ¶
func (s *GetListNotModified) SetCacheControl(val string)
SetCacheControl sets the value of CacheControl.
func (*GetListNotModified) SetETag ¶
func (s *GetListNotModified) SetETag(val string)
SetETag sets the value of ETag.
type GetListParams ¶
type GetListParams struct {
// The ETag of a list the client holds; a match answers 304.
IfNoneMatch OptString `json:",omitempty,omitzero"`
}
GetListParams is parameters of getList operation.
type GetListRes ¶
type GetListRes interface {
// contains filtered or unexported methods
}
type Handler ¶
type Handler interface {
// GetHealth implements getHealth operation.
//
// Answers while the daemon serves, whether or not its last run succeeded: a failing source must not
// restart it.
//
// GET /api/v1/health
GetHealth(ctx context.Context) (*Health, error)
// GetList implements getList operation.
//
// The current list as an envelope of the exact payload bytes and their OpenSSH signature. The
// payload's format is `Payload`. An unchanged list keeps its generation and is signed again every
// refresh interval with a new `generated_at`, so its ETag changes then too.
//
// GET /api/v1/list
GetList(ctx context.Context, params GetListParams) (GetListRes, error)
// NewError creates *ProblemStatusCode from error returned by handler.
//
// Used for common default response.
NewError(ctx context.Context, err error) *ProblemStatusCode
}
Handler handles operations described by OpenAPI v3 specification.
type Health ¶
type Health struct {
Status HealthStatus `json:"status"`
// The build's version.
Version string `json:"version"`
// The served list's generation; 0 before the first.
Generation int64 `json:"generation"`
// When a run last succeeded, in UTC.
LastSuccess OptDateTime `json:"lastSuccess"`
}
Ref: #/components/schemas/Health
func (*Health) GetGeneration ¶
GetGeneration returns the value of Generation.
func (*Health) GetLastSuccess ¶
func (s *Health) GetLastSuccess() OptDateTime
GetLastSuccess returns the value of LastSuccess.
func (*Health) GetStatus ¶
func (s *Health) GetStatus() HealthStatus
GetStatus returns the value of Status.
func (*Health) GetVersion ¶
GetVersion returns the value of Version.
func (*Health) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Health) SetGeneration ¶
SetGeneration sets the value of Generation.
func (*Health) SetLastSuccess ¶
func (s *Health) SetLastSuccess(val OptDateTime)
SetLastSuccess sets the value of LastSuccess.
func (*Health) SetStatus ¶
func (s *Health) SetStatus(val HealthStatus)
SetStatus sets the value of Status.
func (*Health) SetVersion ¶
SetVersion sets the value of Version.
func (*Health) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type HealthStatus ¶
type HealthStatus string
const (
HealthStatusOk HealthStatus = "ok"
)
func (HealthStatus) AllValues ¶
func (HealthStatus) AllValues() []HealthStatus
AllValues returns all HealthStatus values.
func (*HealthStatus) Decode ¶
func (s *HealthStatus) Decode(d *jx.Decoder) error
Decode decodes HealthStatus from json.
func (HealthStatus) Encode ¶
func (s HealthStatus) Encode(e *jx.Encoder)
Encode encodes HealthStatus as json.
func (HealthStatus) MarshalJSON ¶
func (s HealthStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (HealthStatus) MarshalText ¶
func (s HealthStatus) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*HealthStatus) UnmarshalJSON ¶
func (s *HealthStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*HealthStatus) UnmarshalText ¶
func (s *HealthStatus) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (HealthStatus) Validate ¶
func (s HealthStatus) Validate() error
type OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const ( GetHealthOperation OperationName = "GetHealth" GetListOperation OperationName = "GetList" )
type OptDateTime ¶
OptDateTime is optional time.Time.
func NewOptDateTime ¶
func NewOptDateTime(v time.Time) OptDateTime
NewOptDateTime returns new OptDateTime with value set to v.
func (OptDateTime) Get ¶
func (o OptDateTime) Get() (v time.Time, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptDateTime) IsSet ¶
func (o OptDateTime) IsSet() bool
IsSet returns true if OptDateTime was set.
func (OptDateTime) MarshalJSON ¶
func (s OptDateTime) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (OptDateTime) Or ¶
func (o OptDateTime) Or(d time.Time) time.Time
Or returns value if set, or given parameter if does not.
func (*OptDateTime) UnmarshalJSON ¶
func (s *OptDateTime) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type OptString ¶
OptString is optional string.
func NewOptString ¶
NewOptString returns new OptString with value set to v.
func (OptString) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptString) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptURI ¶
OptURI is optional url.URL.
func (OptURI) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptURI) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Problem ¶
type Problem struct {
Type OptURI `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail OptString `json:"detail"`
Instance OptURI `json:"instance"`
}
RFC 9457 problem details. Ref: #/components/schemas/Problem
func (*Problem) GetInstance ¶
GetInstance returns the value of Instance.
func (*Problem) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Problem) SetInstance ¶
SetInstance sets the value of Instance.
func (*Problem) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type ProblemStatusCode ¶
ProblemStatusCode wraps Problem with StatusCode.
func (*ProblemStatusCode) Error ¶
func (s *ProblemStatusCode) Error() string
func (*ProblemStatusCode) GetResponse ¶
func (s *ProblemStatusCode) GetResponse() Problem
GetResponse returns the value of Response.
func (*ProblemStatusCode) GetStatusCode ¶
func (s *ProblemStatusCode) GetStatusCode() int
GetStatusCode returns the value of StatusCode.
func (*ProblemStatusCode) SetResponse ¶
func (s *ProblemStatusCode) SetResponse(val Problem)
SetResponse sets the value of Response.
func (*ProblemStatusCode) SetStatusCode ¶
func (s *ProblemStatusCode) SetStatusCode(val int)
SetStatusCode sets the value of StatusCode.
func (*ProblemStatusCode) Validate ¶
func (s *ProblemStatusCode) Validate() error
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationGroup ¶
OperationGroup returns the x-ogen-operation-group value.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.
func NewServer ¶
func NewServer(h Handler, opts ...ServerOption) (*Server, error)
NewServer creates new Server.
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption is server config option.
func WithErrorHandler ¶
func WithErrorHandler(h ErrorHandler) ServerOption
WithErrorHandler specifies error handler to use.
func WithMaxMultipartMemory ¶
func WithMaxMultipartMemory(max int64) ServerOption
WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.
func WithMethodNotAllowed ¶
func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
WithMethodNotAllowed specifies Method Not Allowed handler to use.
func WithMiddleware ¶
func WithMiddleware(m ...Middleware) ServerOption
WithMiddleware specifies middlewares to use.
func WithNotFound ¶
func WithNotFound(notFound http.HandlerFunc) ServerOption
WithNotFound specifies Not Found handler to use.
func WithPathPrefix ¶
func WithPathPrefix(prefix string) ServerOption
WithPathPrefix specifies server path prefix.