api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrResp

type ErrResp struct {
	Error OptString `json:"error"`
}

func (*ErrResp) Decode

func (s *ErrResp) Decode(d *jx.Decoder) error

Decode decodes ErrResp from json.

func (*ErrResp) Encode

func (s *ErrResp) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ErrResp) GetError

func (s *ErrResp) GetError() OptString

GetError returns the value of Error.

func (*ErrResp) MarshalJSON

func (s *ErrResp) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ErrResp) SetError

func (s *ErrResp) SetError(val OptString)

SetError sets the value of Error.

func (*ErrResp) UnmarshalJSON

func (s *ErrResp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrRespStatusCode

type ErrRespStatusCode struct {
	StatusCode int
	Response   ErrResp
}

ErrRespStatusCode wraps ErrResp with StatusCode.

func (*ErrRespStatusCode) Error

func (s *ErrRespStatusCode) Error() string

func (*ErrRespStatusCode) GetResponse

func (s *ErrRespStatusCode) GetResponse() ErrResp

GetResponse returns the value of Response.

func (*ErrRespStatusCode) GetStatusCode

func (s *ErrRespStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrRespStatusCode) SetResponse

func (s *ErrRespStatusCode) SetResponse(val ErrResp)

SetResponse sets the value of Response.

func (*ErrRespStatusCode) SetStatusCode

func (s *ErrRespStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// OidcAuthGet implements GET /oidc/auth operation.
	//
	// This endpoint is used with NGINX.
	//
	// GET /oidc/auth
	OidcAuthGet(ctx context.Context, params OidcAuthGetParams) (OidcAuthGetRes, error)
	// OidcCallbackGet implements GET /oidc/callback operation.
	//
	// Checks authorization code with registered provider and saves it to session.
	//
	// GET /oidc/callback
	OidcCallbackGet(ctx context.Context, params OidcCallbackGetParams) (*OidcCallbackGetFound, error)
	// OidcSignInGet implements GET /oidc/sign-in operation.
	//
	// Sigs in.
	//
	// GET /oidc/sign-in
	OidcSignInGet(ctx context.Context) (*OidcSignInGetFound, error)
	// NewError creates *ErrRespStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrRespStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OidcAuthGetAccepted

type OidcAuthGetAccepted struct {
	XClaims OptString
}

OidcAuthGetAccepted is response for OidcAuthGet operation.

func (*OidcAuthGetAccepted) GetXClaims

func (s *OidcAuthGetAccepted) GetXClaims() OptString

GetXClaims returns the value of XClaims.

func (*OidcAuthGetAccepted) SetXClaims

func (s *OidcAuthGetAccepted) SetXClaims(val OptString)

SetXClaims sets the value of XClaims.

type OidcAuthGetParams

type OidcAuthGetParams struct {
	// Session cookie for authentication.
	GoOidcAuthProxy OptString
}

OidcAuthGetParams is parameters of GET /oidc/auth operation.

type OidcAuthGetRes

type OidcAuthGetRes interface {
	// contains filtered or unexported methods
}

type OidcAuthGetUnauthorized

type OidcAuthGetUnauthorized struct{}

OidcAuthGetUnauthorized is response for OidcAuthGet operation.

type OidcCallbackGetFound

type OidcCallbackGetFound struct {
	Location  OptString
	SetCookie OptString
}

OidcCallbackGetFound is response for OidcCallbackGet operation.

func (*OidcCallbackGetFound) GetLocation

func (s *OidcCallbackGetFound) GetLocation() OptString

GetLocation returns the value of Location.

func (*OidcCallbackGetFound) GetSetCookie

func (s *OidcCallbackGetFound) GetSetCookie() OptString

GetSetCookie returns the value of SetCookie.

func (*OidcCallbackGetFound) SetLocation

func (s *OidcCallbackGetFound) SetLocation(val OptString)

SetLocation sets the value of Location.

func (*OidcCallbackGetFound) SetSetCookie

func (s *OidcCallbackGetFound) SetSetCookie(val OptString)

SetSetCookie sets the value of SetCookie.

type OidcCallbackGetParams

type OidcCallbackGetParams struct {
	// Nonce for the request.
	GoOidcAuthProxyNounce OptString
	// State parameter for the request.
	GoOidcAuthProxyState OptString
	// State parameter for the request.
	State OptString
	// Code parameter for the request.
	Code OptString
}

OidcCallbackGetParams is parameters of GET /oidc/callback operation.

type OidcSignInGetFound

type OidcSignInGetFound struct {
	Location  OptString
	SetCookie []string
}

OidcSignInGetFound is response for OidcSignInGet operation.

func (*OidcSignInGetFound) GetLocation

func (s *OidcSignInGetFound) GetLocation() OptString

GetLocation returns the value of Location.

func (*OidcSignInGetFound) GetSetCookie

func (s *OidcSignInGetFound) GetSetCookie() []string

GetSetCookie returns the value of SetCookie.

func (*OidcSignInGetFound) SetLocation

func (s *OidcSignInGetFound) SetLocation(val OptString)

SetLocation sets the value of Location.

func (*OidcSignInGetFound) SetSetCookie

func (s *OidcSignInGetFound) SetSetCookie(val []string)

SetSetCookie sets the value of SetCookie.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
}

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) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

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.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

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 UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) NewError

NewError creates *ErrRespStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) OidcAuthGet

OidcAuthGet implements GET /oidc/auth operation.

This endpoint is used with NGINX.

GET /oidc/auth

func (UnimplementedHandler) OidcCallbackGet

OidcCallbackGet implements GET /oidc/callback operation.

Checks authorization code with registered provider and saves it to session.

GET /oidc/callback

func (UnimplementedHandler) OidcSignInGet

func (UnimplementedHandler) OidcSignInGet(ctx context.Context) (r *OidcSignInGetFound, _ error)

OidcSignInGet implements GET /oidc/sign-in operation.

Sigs in.

GET /oidc/sign-in

Jump to

Keyboard shortcuts

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