Documentation ¶
Index ¶
- func GenerateEndpointKey(method, url string) string
- func GeneratePrivateKey(keySize int) (*rsa.PrivateKey, error)
- func NewEngine(certSubject CertificateSubject, privateKey *rsa.PrivateKey, config Config) (*engine, error)
- func NewScope(w http.ResponseWriter, r *http.Request) *scope
- func NewTestRequest() *request
- func NewTestScope(method string, req Request, c Controller) *scopeTest
- func NotFound(scope Scope)
- type CertificateSubject
- type Config
- type Controller
- type Endpoints
- type Handler
- type Interceptor
- type InterceptorI
- type Measurement
- type Request
- type Resource
- type Scope
- type ScopeTest
- type Service
- type ValidationRule
- type ValidationRuleError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateEndpointKey ¶
GenerateEndpointKey generates a key used to identify urls using a request method and url
func GeneratePrivateKey ¶
func GeneratePrivateKey(keySize int) (*rsa.PrivateKey, error)
func NewEngine ¶
func NewEngine(certSubject CertificateSubject, privateKey *rsa.PrivateKey, config Config) (*engine, error)
func NewScope ¶
func NewScope(w http.ResponseWriter, r *http.Request) *scope
NewScope creates a Handler's scope instance
func NewTestRequest ¶ added in v0.0.2
func NewTestRequest() *request
func NewTestScope ¶
func NewTestScope(method string, req Request, c Controller) *scopeTest
NewTestScope creates a Handler's scope instance for testing purposes
Types ¶
type CertificateSubject ¶
type Controller ¶
type Interceptor ¶
type Interceptor func(s *scope) error
Interceptor can be executed before and after a request with the given scope
type InterceptorI ¶
type Measurement ¶
type Measurement struct {
// contains filtered or unexported fields
}
Measurement logs information about the the api and its performance
func (*Measurement) After ¶
func (m *Measurement) After(s *scope) error
After gets called after the endpoint gets called
func (*Measurement) Before ¶
func (m *Measurement) Before(s *scope) error
Before gets called before the endpoint gets called
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
func (*Resource) GetHandler ¶
type Scope ¶
type Scope interface { GetData(key string) (any, error) SetData(key string, val any) error OverrideData(key string, val any) Method() string Path() string Reply(status int, body interface{}) QueryValue(key string) string ValidateQuery(payload interface{}) error ValidateJsonBody(payload interface{}) error ValidateHeaders(payload interface{}) error }
type Service ¶
type Service struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Internal string `json:"internal,omitempty"` External string `json:"external,omitempty"` }
Service holds information about a server which references an individual conf within a cluster of servers
type ValidationRule ¶
type ValidationRuleError ¶
Click to show internal directories.
Click to hide internal directories.