Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type Error
- func (s *Error) Decode(d *jx.Decoder) error
- func (s *Error) Encode(e *jx.Encoder)
- func (s *Error) GetErrorMessage() string
- func (s *Error) GetSpanID() OptSpanID
- func (s *Error) GetTraceID() OptTraceID
- func (s *Error) MarshalJSON() ([]byte, error)
- func (s *Error) SetErrorMessage(val string)
- func (s *Error) SetSpanID(val OptSpanID)
- func (s *Error) SetTraceID(val OptTraceID)
- func (s *Error) UnmarshalJSON(data []byte) error
- func (s *Error) Validate() error
- type ErrorHandler
- type ErrorStatusCode
- type GetStatusOK
- type Handler
- type Invoker
- type Labeler
- type Middleware
- type OperationName
- type OptSpanID
- func (o *OptSpanID) Decode(d *jx.Decoder) error
- func (o OptSpanID) Encode(e *jx.Encoder)
- func (o OptSpanID) Get() (v SpanID, ok bool)
- func (o OptSpanID) IsSet() bool
- func (s OptSpanID) MarshalJSON() ([]byte, error)
- func (o OptSpanID) Or(d SpanID) SpanID
- func (o *OptSpanID) Reset()
- func (o *OptSpanID) SetTo(v SpanID)
- func (s *OptSpanID) UnmarshalJSON(data []byte) error
- type OptTraceID
- func (o *OptTraceID) Decode(d *jx.Decoder) error
- func (o OptTraceID) Encode(e *jx.Encoder)
- func (o OptTraceID) Get() (v TraceID, ok bool)
- func (o OptTraceID) IsSet() bool
- func (s OptTraceID) MarshalJSON() ([]byte, error)
- func (o OptTraceID) Or(d TraceID) TraceID
- func (o *OptTraceID) Reset()
- func (o *OptTraceID) SetTo(v TraceID)
- func (s *OptTraceID) UnmarshalJSON(data []byte) error
- type Option
- type PingNoContent
- type Route
- type SecurityHandler
- type SecuritySource
- 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
- type SpanID
- type SubmitReportCreated
- type SubmitReportReq
- func (s *SubmitReportReq) Decode(d *jx.Decoder) error
- func (s *SubmitReportReq) Encode(e *jx.Encoder)
- func (s *SubmitReportReq) GetMeasurement() float64
- func (s *SubmitReportReq) GetReport() string
- func (s *SubmitReportReq) MarshalJSON() ([]byte, error)
- func (s *SubmitReportReq) SetMeasurement(val float64)
- func (s *SubmitReportReq) SetReport(val string)
- func (s *SubmitReportReq) UnmarshalJSON(data []byte) error
- func (s *SubmitReportReq) Validate() error
- type TokenAuth
- type TraceID
- type UnimplementedHandler
- func (UnimplementedHandler) GetStatus(ctx context.Context) (r *GetStatusOK, _ error)
- func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)
- func (UnimplementedHandler) Ping(ctx context.Context) error
- func (UnimplementedHandler) SubmitReport(ctx context.Context, req *SubmitReportReq) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements OAS client.
func NewClient ¶
func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)
NewClient initializes new Client defined by OAS.
func (*Client) GetStatus ¶
func (c *Client) GetStatus(ctx context.Context) (*GetStatusOK, error)
GetStatus invokes getStatus operation.
Get status.
GET /status
func (*Client) SubmitReport ¶ added in v0.10.0
func (c *Client) SubmitReport(ctx context.Context, request *SubmitReportReq) error
SubmitReport invokes submitReport operation.
Submit benchmark report.
POST /report/submit
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption is client config option.
func WithClient ¶
func WithClient(client ht.Client) ClientOption
WithClient specifies http client to use.
type Error ¶
type Error struct { // Human-readable error message. ErrorMessage string `json:"error_message"` TraceID OptTraceID `json:"trace_id"` SpanID OptSpanID `json:"span_id"` }
Error occurred while processing request. Ref: #/components/schemas/Error
func (*Error) GetErrorMessage ¶
GetErrorMessage returns the value of ErrorMessage.
func (*Error) GetTraceID ¶
func (s *Error) GetTraceID() OptTraceID
GetTraceID returns the value of TraceID.
func (*Error) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Error) SetErrorMessage ¶
SetErrorMessage sets the value of ErrorMessage.
func (*Error) SetTraceID ¶
func (s *Error) SetTraceID(val OptTraceID)
SetTraceID sets the value of TraceID.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type ErrorStatusCode ¶
ErrorStatusCode wraps Error with StatusCode.
func (*ErrorStatusCode) Error ¶
func (s *ErrorStatusCode) Error() string
func (*ErrorStatusCode) GetResponse ¶
func (s *ErrorStatusCode) GetResponse() Error
GetResponse returns the value of Response.
func (*ErrorStatusCode) GetStatusCode ¶
func (s *ErrorStatusCode) GetStatusCode() int
GetStatusCode returns the value of StatusCode.
func (*ErrorStatusCode) SetResponse ¶
func (s *ErrorStatusCode) SetResponse(val Error)
SetResponse sets the value of Response.
func (*ErrorStatusCode) SetStatusCode ¶
func (s *ErrorStatusCode) SetStatusCode(val int)
SetStatusCode sets the value of StatusCode.
func (*ErrorStatusCode) Validate ¶
func (s *ErrorStatusCode) Validate() error
type GetStatusOK ¶
type GetStatusOK struct { // Status. Status string `json:"status"` }
func (*GetStatusOK) Decode ¶
func (s *GetStatusOK) Decode(d *jx.Decoder) error
Decode decodes GetStatusOK from json.
func (*GetStatusOK) Encode ¶
func (s *GetStatusOK) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*GetStatusOK) GetStatus ¶
func (s *GetStatusOK) GetStatus() string
GetStatus returns the value of Status.
func (*GetStatusOK) MarshalJSON ¶
func (s *GetStatusOK) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*GetStatusOK) SetStatus ¶
func (s *GetStatusOK) SetStatus(val string)
SetStatus sets the value of Status.
func (*GetStatusOK) UnmarshalJSON ¶
func (s *GetStatusOK) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type Handler ¶
type Handler interface { // GetStatus implements getStatus operation. // // Get status. // // GET /status GetStatus(ctx context.Context) (*GetStatusOK, error) // Ping implements ping operation. // // GET /ping Ping(ctx context.Context) error // SubmitReport implements submitReport operation. // // Submit benchmark report. // // POST /report/submit SubmitReport(ctx context.Context, req *SubmitReportReq) error // NewError creates *ErrorStatusCode from error returned by handler. // // Used for common default response. NewError(ctx context.Context, err error) *ErrorStatusCode }
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶
type Invoker interface { // GetStatus invokes getStatus operation. // // Get status. // // GET /status GetStatus(ctx context.Context) (*GetStatusOK, error) // Ping invokes ping operation. // // GET /ping Ping(ctx context.Context) error // SubmitReport invokes submitReport operation. // // Submit benchmark report. // // POST /report/submit SubmitReport(ctx context.Context, request *SubmitReportReq) error }
Invoker invokes operations described by OpenAPI v3 specification.
type Labeler ¶ added in v0.10.0
type Labeler struct {
// contains filtered or unexported fields
}
Labeler is used to allow adding custom attributes to the server request metrics.
func LabelerFromContext ¶ added in v0.10.0
LabelerFromContext retrieves the Labeler from the provided context, if present.
If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.
func (*Labeler) AttributeSet ¶ added in v0.10.0
AttributeSet returns the attributes added to the Labeler as an attribute.Set.
type OperationName ¶ added in v0.16.0
type OperationName = string
OperationName is the ogen operation name
const ( GetStatusOperation OperationName = "GetStatus" PingOperation OperationName = "Ping" SubmitReportOperation OperationName = "SubmitReport" )
type OptSpanID ¶
OptSpanID is optional SpanID.
func NewOptSpanID ¶
NewOptSpanID returns new OptSpanID with value set to v.
func (OptSpanID) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptSpanID) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptTraceID ¶
OptTraceID is optional TraceID.
func NewOptTraceID ¶
func NewOptTraceID(v TraceID) OptTraceID
NewOptTraceID returns new OptTraceID with value set to v.
func (*OptTraceID) Decode ¶
func (o *OptTraceID) Decode(d *jx.Decoder) error
Decode decodes TraceID from json.
func (OptTraceID) Encode ¶
func (o OptTraceID) Encode(e *jx.Encoder)
Encode encodes TraceID as json.
func (OptTraceID) Get ¶
func (o OptTraceID) Get() (v TraceID, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptTraceID) IsSet ¶
func (o OptTraceID) IsSet() bool
IsSet returns true if OptTraceID was set.
func (OptTraceID) MarshalJSON ¶
func (s OptTraceID) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (OptTraceID) Or ¶
func (o OptTraceID) Or(d TraceID) TraceID
Or returns value if set, or given parameter if does not.
func (*OptTraceID) UnmarshalJSON ¶
func (s *OptTraceID) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type Option ¶
type Option interface { ServerOption ClientOption }
Option is config option.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) Option
WithMeterProvider specifies a meter provider to use for creating a meter.
If none is specified, the otel.GetMeterProvider() is used.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer.
If none is specified, the global provider is used.
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
type SecurityHandler ¶
type SecurityHandler interface { // HandleTokenAuth handles tokenAuth security. // Contains GITHUB_TOKEN, like `${{ secrets.GITHUB_TOKEN }}`. HandleTokenAuth(ctx context.Context, operationName OperationName, t TokenAuth) (context.Context, error) }
SecurityHandler is handler for security parameters.
type SecuritySource ¶
type SecuritySource interface { // TokenAuth provides tokenAuth security value. // Contains GITHUB_TOKEN, like `${{ secrets.GITHUB_TOKEN }}`. TokenAuth(ctx context.Context, operationName OperationName) (TokenAuth, error) }
SecuritySource is provider of security values (tokens, passwords, etc.).
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, sec SecurityHandler, 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.
type SpanID ¶
type SpanID string
func (SpanID) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*SpanID) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type SubmitReportCreated ¶ added in v0.10.0
type SubmitReportCreated struct{}
SubmitReportCreated is response for SubmitReport operation.
type SubmitReportReq ¶ added in v0.10.0
type SubmitReportReq struct { // Benchmark report type. Report string `json:"report"` // Measurement value. Measurement float64 `json:"measurement"` }
func (*SubmitReportReq) Decode ¶ added in v0.10.0
func (s *SubmitReportReq) Decode(d *jx.Decoder) error
Decode decodes SubmitReportReq from json.
func (*SubmitReportReq) Encode ¶ added in v0.10.0
func (s *SubmitReportReq) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*SubmitReportReq) GetMeasurement ¶ added in v0.10.0
func (s *SubmitReportReq) GetMeasurement() float64
GetMeasurement returns the value of Measurement.
func (*SubmitReportReq) GetReport ¶ added in v0.10.0
func (s *SubmitReportReq) GetReport() string
GetReport returns the value of Report.
func (*SubmitReportReq) MarshalJSON ¶ added in v0.10.0
func (s *SubmitReportReq) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*SubmitReportReq) SetMeasurement ¶ added in v0.10.0
func (s *SubmitReportReq) SetMeasurement(val float64)
SetMeasurement sets the value of Measurement.
func (*SubmitReportReq) SetReport ¶ added in v0.10.0
func (s *SubmitReportReq) SetReport(val string)
SetReport sets the value of Report.
func (*SubmitReportReq) UnmarshalJSON ¶ added in v0.10.0
func (s *SubmitReportReq) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*SubmitReportReq) Validate ¶ added in v0.10.0
func (s *SubmitReportReq) Validate() error
type TokenAuth ¶
type TokenAuth struct {
APIKey string
}
type TraceID ¶
type TraceID string
func (TraceID) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*TraceID) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) GetStatus ¶
func (UnimplementedHandler) GetStatus(ctx context.Context) (r *GetStatusOK, _ error)
GetStatus implements getStatus operation.
Get status.
GET /status
func (UnimplementedHandler) NewError ¶
func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)
NewError creates *ErrorStatusCode from error returned by handler.
Used for common default response.
func (UnimplementedHandler) Ping ¶
func (UnimplementedHandler) Ping(ctx context.Context) error
Ping implements ping operation.
GET /ping
func (UnimplementedHandler) SubmitReport ¶ added in v0.10.0
func (UnimplementedHandler) SubmitReport(ctx context.Context, req *SubmitReportReq) error
SubmitReport implements submitReport operation.
Submit benchmark report.
POST /report/submit
Source Files ¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_middleware_gen.go
- oas_operations_gen.go
- oas_request_decoders_gen.go
- oas_request_encoders_gen.go
- oas_response_decoders_gen.go
- oas_response_encoders_gen.go
- oas_router_gen.go
- oas_schemas_gen.go
- oas_security_gen.go
- oas_server_gen.go
- oas_unimplemented_gen.go
- oas_validators_gen.go