api

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) ProbeLiveness

func (c *Client) ProbeLiveness(ctx context.Context) (*ProbeLivenessOK, error)

ProbeLiveness invokes probeLiveness operation.

Liveness probe for kubernetes.

GET /healthz

type ClientOption added in v0.55.0

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 ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// ProbeLiveness implements probeLiveness operation.
	//
	// Liveness probe for kubernetes.
	//
	// GET /healthz
	ProbeLiveness(ctx context.Context) (*ProbeLivenessOK, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker added in v0.75.0

type Invoker interface {
	// ProbeLiveness invokes probeLiveness operation.
	//
	// Liveness probe for kubernetes.
	//
	// GET /healthz
	ProbeLiveness(ctx context.Context) (*ProbeLivenessOK, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Labeler added in v1.1.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 v1.1.0

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

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) Add added in v1.1.0

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet added in v1.1.0

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

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 PascalExceptionStrat

type PascalExceptionStrat string

Ref: #/components/schemas/PascalExceptionStrat

const (
	PascalExceptionStrat1      PascalExceptionStrat = "1"
	PascalExceptionStratMinus2 PascalExceptionStrat = "-2"
)

func (PascalExceptionStrat) AllValues added in v0.74.0

AllValues returns all PascalExceptionStrat values.

func (*PascalExceptionStrat) Decode

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

Decode decodes PascalExceptionStrat from json.

func (PascalExceptionStrat) Encode

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

Encode encodes PascalExceptionStrat as json.

func (PascalExceptionStrat) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (PascalExceptionStrat) MarshalText added in v0.56.0

func (s PascalExceptionStrat) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*PascalExceptionStrat) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PascalExceptionStrat) UnmarshalText added in v0.56.0

func (s *PascalExceptionStrat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (PascalExceptionStrat) Validate

func (s PascalExceptionStrat) Validate() error

type PascalSpecialStrat

type PascalSpecialStrat string

Ref: #/components/schemas/PascalSpecialStrat

const (
	PascalSpecialStrat2Plus2  PascalSpecialStrat = "2+2"
	PascalSpecialStrat2Minus2 PascalSpecialStrat = "2-2"
)

func (PascalSpecialStrat) AllValues added in v0.74.0

func (PascalSpecialStrat) AllValues() []PascalSpecialStrat

AllValues returns all PascalSpecialStrat values.

func (*PascalSpecialStrat) Decode

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

Decode decodes PascalSpecialStrat from json.

func (PascalSpecialStrat) Encode

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

Encode encodes PascalSpecialStrat as json.

func (PascalSpecialStrat) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (PascalSpecialStrat) MarshalText added in v0.56.0

func (s PascalSpecialStrat) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*PascalSpecialStrat) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PascalSpecialStrat) UnmarshalText added in v0.56.0

func (s *PascalSpecialStrat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (PascalSpecialStrat) Validate

func (s PascalSpecialStrat) Validate() error

type PascalStrat

type PascalStrat string

Ref: #/components/schemas/PascalStrat

const (
	PascalStratInSync    PascalStrat = "in-sync"
	PascalStratOutOfSync PascalStrat = "out-of-sync"
)

func (PascalStrat) AllValues added in v0.74.0

func (PascalStrat) AllValues() []PascalStrat

AllValues returns all PascalStrat values.

func (*PascalStrat) Decode

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

Decode decodes PascalStrat from json.

func (PascalStrat) Encode

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

Encode encodes PascalStrat as json.

func (PascalStrat) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (PascalStrat) MarshalText added in v0.56.0

func (s PascalStrat) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*PascalStrat) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PascalStrat) UnmarshalText added in v0.56.0

func (s *PascalStrat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (PascalStrat) Validate

func (s PascalStrat) Validate() error

type ProbeLivenessOK

type ProbeLivenessOK struct {
	VeryBadEnum          VeryBadEnum          `json:"VeryBadEnum"`
	PascalStrat          PascalStrat          `json:"PascalStrat"`
	PascalSpecialStrat   PascalSpecialStrat   `json:"PascalSpecialStrat"`
	PascalExceptionStrat PascalExceptionStrat `json:"PascalExceptionStrat"`
}

func (*ProbeLivenessOK) Decode

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

Decode decodes ProbeLivenessOK from json.

func (*ProbeLivenessOK) Encode

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

Encode implements json.Marshaler.

func (*ProbeLivenessOK) GetPascalExceptionStrat

func (s *ProbeLivenessOK) GetPascalExceptionStrat() PascalExceptionStrat

GetPascalExceptionStrat returns the value of PascalExceptionStrat.

func (*ProbeLivenessOK) GetPascalSpecialStrat

func (s *ProbeLivenessOK) GetPascalSpecialStrat() PascalSpecialStrat

GetPascalSpecialStrat returns the value of PascalSpecialStrat.

func (*ProbeLivenessOK) GetPascalStrat

func (s *ProbeLivenessOK) GetPascalStrat() PascalStrat

GetPascalStrat returns the value of PascalStrat.

func (*ProbeLivenessOK) GetVeryBadEnum

func (s *ProbeLivenessOK) GetVeryBadEnum() VeryBadEnum

GetVeryBadEnum returns the value of VeryBadEnum.

func (*ProbeLivenessOK) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ProbeLivenessOK) SetPascalExceptionStrat

func (s *ProbeLivenessOK) SetPascalExceptionStrat(val PascalExceptionStrat)

SetPascalExceptionStrat sets the value of PascalExceptionStrat.

func (*ProbeLivenessOK) SetPascalSpecialStrat

func (s *ProbeLivenessOK) SetPascalSpecialStrat(val PascalSpecialStrat)

SetPascalSpecialStrat sets the value of PascalSpecialStrat.

func (*ProbeLivenessOK) SetPascalStrat

func (s *ProbeLivenessOK) SetPascalStrat(val PascalStrat)

SetPascalStrat sets the value of PascalStrat.

func (*ProbeLivenessOK) SetVeryBadEnum

func (s *ProbeLivenessOK) SetVeryBadEnum(val VeryBadEnum)

SetVeryBadEnum sets the value of VeryBadEnum.

func (*ProbeLivenessOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ProbeLivenessOK) Validate

func (s *ProbeLivenessOK) Validate() error

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 added in v0.58.0

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary added in v0.76.0

func (r Route) Summary() string

Summary returns OpenAPI summary.

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 added in v0.56.0

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 added in v0.55.0

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

func (UnimplementedHandler) ProbeLiveness(ctx context.Context) (r *ProbeLivenessOK, _ error)

ProbeLiveness implements probeLiveness operation.

Liveness probe for kubernetes.

GET /healthz

type VeryBadEnum

type VeryBadEnum string

Ref: #/components/schemas/VeryBadEnum

const (
	VeryBadEnum_0   VeryBadEnum = " "
	VeryBadEnum_1   VeryBadEnum = "!"
	VeryBadEnum_2   VeryBadEnum = "\""
	VeryBadEnum_3   VeryBadEnum = "#"
	VeryBadEnum_4   VeryBadEnum = "$"
	VeryBadEnum_5   VeryBadEnum = "%"
	VeryBadEnum_6   VeryBadEnum = "&"
	VeryBadEnum_7   VeryBadEnum = "'"
	VeryBadEnum_8   VeryBadEnum = "("
	VeryBadEnum_9   VeryBadEnum = ")"
	VeryBadEnum_10  VeryBadEnum = "*"
	VeryBadEnum_11  VeryBadEnum = "+"
	VeryBadEnum_12  VeryBadEnum = ","
	VeryBadEnum_13  VeryBadEnum = "-"
	VeryBadEnum_14  VeryBadEnum = "."
	VeryBadEnum_15  VeryBadEnum = "/"
	VeryBadEnum_16  VeryBadEnum = "0"
	VeryBadEnum_17  VeryBadEnum = "1"
	VeryBadEnum_18  VeryBadEnum = "2"
	VeryBadEnum_19  VeryBadEnum = "3"
	VeryBadEnum_20  VeryBadEnum = "4"
	VeryBadEnum_21  VeryBadEnum = "5"
	VeryBadEnum_22  VeryBadEnum = "6"
	VeryBadEnum_23  VeryBadEnum = "7"
	VeryBadEnum_24  VeryBadEnum = "8"
	VeryBadEnum_25  VeryBadEnum = "9"
	VeryBadEnum_26  VeryBadEnum = ":"
	VeryBadEnum_27  VeryBadEnum = ";"
	VeryBadEnum_28  VeryBadEnum = "<"
	VeryBadEnum_29  VeryBadEnum = "="
	VeryBadEnum_30  VeryBadEnum = ">"
	VeryBadEnum_31  VeryBadEnum = "?"
	VeryBadEnum_32  VeryBadEnum = "@"
	VeryBadEnum_33  VeryBadEnum = "A"
	VeryBadEnum_34  VeryBadEnum = "B"
	VeryBadEnum_35  VeryBadEnum = "C"
	VeryBadEnum_36  VeryBadEnum = "D"
	VeryBadEnum_37  VeryBadEnum = "E"
	VeryBadEnum_38  VeryBadEnum = "F"
	VeryBadEnum_39  VeryBadEnum = "G"
	VeryBadEnum_40  VeryBadEnum = "H"
	VeryBadEnum_41  VeryBadEnum = "I"
	VeryBadEnum_42  VeryBadEnum = "J"
	VeryBadEnum_43  VeryBadEnum = "K"
	VeryBadEnum_44  VeryBadEnum = "L"
	VeryBadEnum_45  VeryBadEnum = "M"
	VeryBadEnum_46  VeryBadEnum = "N"
	VeryBadEnum_47  VeryBadEnum = "O"
	VeryBadEnum_48  VeryBadEnum = "P"
	VeryBadEnum_49  VeryBadEnum = "Q"
	VeryBadEnum_50  VeryBadEnum = "R"
	VeryBadEnum_51  VeryBadEnum = "S"
	VeryBadEnum_52  VeryBadEnum = "T"
	VeryBadEnum_53  VeryBadEnum = "U"
	VeryBadEnum_54  VeryBadEnum = "V"
	VeryBadEnum_55  VeryBadEnum = "W"
	VeryBadEnum_56  VeryBadEnum = "X"
	VeryBadEnum_57  VeryBadEnum = "Y"
	VeryBadEnum_58  VeryBadEnum = "Z"
	VeryBadEnum_59  VeryBadEnum = "["
	VeryBadEnum_60  VeryBadEnum = "\\"
	VeryBadEnum_61  VeryBadEnum = "]"
	VeryBadEnum_62  VeryBadEnum = "^"
	VeryBadEnum_63  VeryBadEnum = "_"
	VeryBadEnum_64  VeryBadEnum = "`"
	VeryBadEnum_65  VeryBadEnum = "a"
	VeryBadEnum_66  VeryBadEnum = "b"
	VeryBadEnum_67  VeryBadEnum = "c"
	VeryBadEnum_68  VeryBadEnum = "d"
	VeryBadEnum_69  VeryBadEnum = "e"
	VeryBadEnum_70  VeryBadEnum = "f"
	VeryBadEnum_71  VeryBadEnum = "g"
	VeryBadEnum_72  VeryBadEnum = "h"
	VeryBadEnum_73  VeryBadEnum = "i"
	VeryBadEnum_74  VeryBadEnum = "j"
	VeryBadEnum_75  VeryBadEnum = "k"
	VeryBadEnum_76  VeryBadEnum = "l"
	VeryBadEnum_77  VeryBadEnum = "m"
	VeryBadEnum_78  VeryBadEnum = "n"
	VeryBadEnum_79  VeryBadEnum = "o"
	VeryBadEnum_80  VeryBadEnum = "p"
	VeryBadEnum_81  VeryBadEnum = "q"
	VeryBadEnum_82  VeryBadEnum = "r"
	VeryBadEnum_83  VeryBadEnum = "s"
	VeryBadEnum_84  VeryBadEnum = "t"
	VeryBadEnum_85  VeryBadEnum = "u"
	VeryBadEnum_86  VeryBadEnum = "v"
	VeryBadEnum_87  VeryBadEnum = "w"
	VeryBadEnum_88  VeryBadEnum = "x"
	VeryBadEnum_89  VeryBadEnum = "y"
	VeryBadEnum_90  VeryBadEnum = "z"
	VeryBadEnum_91  VeryBadEnum = "{"
	VeryBadEnum_92  VeryBadEnum = "|"
	VeryBadEnum_93  VeryBadEnum = "}"
	VeryBadEnum_94  VeryBadEnum = "~"
	VeryBadEnum_95  VeryBadEnum = "id"
	VeryBadEnum_96  VeryBadEnum = "id desc"
	VeryBadEnum_97  VeryBadEnum = "classifyAs"
	VeryBadEnum_98  VeryBadEnum = "classifyAs desc"
	VeryBadEnum_99  VeryBadEnum = "senderEmailAddress"
	VeryBadEnum_100 VeryBadEnum = "senderEmailAddress desc"
	VeryBadEnum_101 VeryBadEnum = "childFolders"
	VeryBadEnum_102 VeryBadEnum = "messageRules"
	VeryBadEnum_103 VeryBadEnum = "messages"
	VeryBadEnum_104 VeryBadEnum = "multiValueExtendedProperties"
	VeryBadEnum_105 VeryBadEnum = "singleValueExtendedProperties"
)

func (VeryBadEnum) AllValues added in v0.74.0

func (VeryBadEnum) AllValues() []VeryBadEnum

AllValues returns all VeryBadEnum values.

func (*VeryBadEnum) Decode

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

Decode decodes VeryBadEnum from json.

func (VeryBadEnum) Encode

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

Encode encodes VeryBadEnum as json.

func (VeryBadEnum) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (VeryBadEnum) MarshalText added in v0.56.0

func (s VeryBadEnum) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*VeryBadEnum) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*VeryBadEnum) UnmarshalText added in v0.56.0

func (s *VeryBadEnum) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (VeryBadEnum) Validate

func (s VeryBadEnum) Validate() error

Jump to

Keyboard shortcuts

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