Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidHTTPMethod = errors.New("not a valid HTTPMethod")
var ErrInvalidRateLimitDescriptionBy = errors.New("not a valid RateLimitDescriptionBy")
Functions ¶
This section is empty.
Types ¶
type HTTPMethod ¶
type HTTPMethod uint8
HTTPMethod ... ENUM(unspecified, get, put, post, delete, patch)
const ( // HTTPMethodUnspecified is a HTTPMethod of type Unspecified. HTTPMethodUnspecified HTTPMethod = iota // HTTPMethodGet is a HTTPMethod of type Get. HTTPMethodGet // HTTPMethodPut is a HTTPMethod of type Put. HTTPMethodPut // HTTPMethodPost is a HTTPMethod of type Post. HTTPMethodPost // HTTPMethodDelete is a HTTPMethod of type Delete. HTTPMethodDelete // HTTPMethodPatch is a HTTPMethod of type Patch. HTTPMethodPatch )
func ParseHTTPMethod ¶
func ParseHTTPMethod(name string) (HTTPMethod, error)
ParseHTTPMethod attempts to convert a string to a HTTPMethod.
func (HTTPMethod) IsValid ¶
func (x HTTPMethod) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (HTTPMethod) String ¶
func (x HTTPMethod) String() string
String implements the Stringer interface.
type Handler ¶
type Handler struct {
Method string
HandlerSettings
AllowedHTTPMethods []HTTPMethod
ProcessFunc HandlerFunc
}
Handler ...
type HandlerFunc ¶
type HandlerFunc func(ctx context.Context, req *ProcessRequest) (*ProcessResponse, error)
HandlerFunc ...
type HandlerSettings ¶
type HandlerSettings struct {
AuditEnabled bool
RateLimiterDescription *RateLimiterDescription
RequiredAuthentication bool
RequiredPermissions []string
}
HandlerSettings ...
type NewOptions ¶
type NewOptions struct {
ServerAddress string
Auth0Domain string
Auth0Audience string
M2MValidation bool
GlobalHandlerSettings HandlerSettings
Handlers []Handler
ServerCloseTimeout time.Duration
Logger *slog.Logger
}
NewOptions ...
type ProcessRequest ¶
type ProcessRequest struct {
HTTPMethod HTTPMethod
Path string
Query url.Values
Body []byte
Headers http.Header
SubjectInformation *SubjectInformation
}
ProcessRequest ...
type ProcessResponse ¶
ProcessResponse ...
type RateLimitDescriptionBy ¶
type RateLimitDescriptionBy uint8
RateLimitDescriptionBy ... ENUM(ip, subject_id)
const ( // RateLimitDescriptionByIp is a RateLimitDescriptionBy of type Ip. RateLimitDescriptionByIp RateLimitDescriptionBy = iota // RateLimitDescriptionBySubjectId is a RateLimitDescriptionBy of type Subject_id. RateLimitDescriptionBySubjectId )
func ParseRateLimitDescriptionBy ¶
func ParseRateLimitDescriptionBy(name string) (RateLimitDescriptionBy, error)
ParseRateLimitDescriptionBy attempts to convert a string to a RateLimitDescriptionBy.
func (RateLimitDescriptionBy) IsValid ¶
func (x RateLimitDescriptionBy) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (RateLimitDescriptionBy) String ¶
func (x RateLimitDescriptionBy) String() string
String implements the Stringer interface.
type RateLimiterDescription ¶
type RateLimiterDescription struct {
By RateLimitDescriptionBy
Rate uint64
Burst uint64
Period time.Duration
}
RateLimiterDescription ...
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK that helps integrate with api-gateway.
func (*SDK) RegisterHandler ¶
RegisterHandler in SDK. All registrations must be done before Run.
type SubjectInformation ¶
SubjectInformation ...