Documentation
¶
Index ¶
- func GenerateRandomString(n int) string
- func InitializeAuthnClient(logger core_logging.ILog) (*core_auth_sdk.Client, error)
- func InitializeLoggingEngine(ctx context.Context) core_logging.ILog
- func InitializeMetricsEngine(serviceName string) *metrics.MetricsEngine
- func InitializeTracingEngine(serviceName string) (*core_tracing.TracingEngine, io.Closer)
- type ArrayResponse
- type Config
- type CreateAccountRequest
- type CreateAccountResponse
- type DeleteAccountRequest
- type DeleteAccountResponse
- type GetAccountRequest
- type GetAccountResponse
- type LockAccountRequest
- type LockAccountResponse
- type LoggingMiddleware
- type LoginAccountRequest
- type LoginAccountResponse
- type MapResponse
- type OperationResponseSwagger
- type PrometheusMiddleware
- type RandomDelayMiddleware
- type RuntimeResponse
- type Server
- func (s *Server) ArchiveAccountIfErrorsOccur(ctx context.Context, err error, authnID int, parentSpan opentracing.Span)
- func (s *Server) DecodeRequestAndInstrument(ctx context.Context, w http.ResponseWriter, r *http.Request, obj interface{}, ...) error
- func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, error string, code int)
- func (s *Server) ExtractIdOperationAndInstrument(ctx context.Context, r *http.Request, operation string) (uint32, error)
- func (s *Server) IsNotAuthenticated(w http.ResponseWriter, r *http.Request) bool
- func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})
- func (s *Server) JSONResponseCode(w http.ResponseWriter, r *http.Request, result interface{}, responseCode int)
- func (s *Server) ListenAndServe(stopCh <-chan struct{})
- func (s *Server) RemoteOperationAndInstrument(ctx context.Context, f func() error, operationType string, took *time.Duration) error
- func (s *Server) RemoteOperationAndInstrumentWithResult(ctx context.Context, f func() (interface{}, error), operationType string, ...) (interface{}, error)
- type UnLockAccountRequest
- type UnLockAccountResponse
- type UpdateAccountRequest
- type UpdateAccountRequestSwagger
- type UpdateAccountResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomString ¶
func InitializeAuthnClient ¶
func InitializeAuthnClient(logger core_logging.ILog) (*core_auth_sdk.Client, error)
func InitializeLoggingEngine ¶
func InitializeLoggingEngine(ctx context.Context) core_logging.ILog
func InitializeMetricsEngine ¶
func InitializeMetricsEngine(serviceName string) *metrics.MetricsEngine
func InitializeTracingEngine ¶
func InitializeTracingEngine(serviceName string) (*core_tracing.TracingEngine, io.Closer)
Types ¶
type ArrayResponse ¶
type ArrayResponse []string
type Config ¶
type Config struct { HttpClientTimeout time.Duration `mapstructure:"http-client-timeout"` HttpServerTimeout time.Duration `mapstructure:"http-server-timeout"` HttpServerShutdownTimeout time.Duration `mapstructure:"http-server-shutdown-timeout"` BackendURL []string `mapstructure:"backend-url"` UILogo string `mapstructure:"ui-logo"` UIMessage string `mapstructure:"ui-message"` UIColor string `mapstructure:"ui-color"` UIPath string `mapstructure:"ui-path"` DataPath string `mapstructure:"data-path"` ConfigPath string `mapstructure:"config-path"` CertPath string `mapstructure:"cert-path"` Port string `mapstructure:"port"` SecurePort string `mapstructure:"secure-port"` PortMetrics int `mapstructure:"port-metrics"` Hostname string `mapstructure:"hostname"` H2C bool `mapstructure:"h2c"` RandomDelay bool `mapstructure:"random-delay"` RandomDelayUnit string `mapstructure:"random-delay-unit"` RandomDelayMin int `mapstructure:"random-delay-min"` RandomDelayMax int `mapstructure:"random-delay-max"` RandomError bool `mapstructure:"random-error"` Unhealthy bool `mapstructure:"unhealthy"` Unready bool `mapstructure:"unready"` JWTSecret string `mapstructure:"jwt-secret"` CacheServer string `mapstructure:"cache-server"` }
type CreateAccountRequest ¶
type CreateAccountResponse ¶
type DeleteAccountRequest ¶
type DeleteAccountRequest struct { // id of the account to delete // in: query // required: true Id uint32 `json:"result"` }
Delete account by id request swagger:parameters deleteAccount
type DeleteAccountResponse ¶
type DeleteAccountResponse struct {
Error error `json:"error"`
}
DeleteAccountResponse is struct providing errors tied to delete account operations
type GetAccountRequest ¶
type GetAccountRequest struct { // id of the account to obtain // in: query // required: true Id uint32 `json:"result"` }
Get account by id request swagger:parameters getAccount
type GetAccountResponse ¶
type GetAccountResponse struct { Account *core_auth_sdk.Account `json:"account"` Error error `json:"error"` }
GetAccountResponse is struct providing errors tied to get account operations
type LockAccountRequest ¶
type LockAccountRequest struct { // id of the account to lock // in: query // required: true Id uint32 `json:"result"` }
Lock account request swagger:parameters lockAccount
type LockAccountResponse ¶
type LockAccountResponse struct {
Error error `json:"error"`
}
LockAccountResponse is struct providing errors tied to lock account operations
type LoggingMiddleware ¶
type LoggingMiddleware struct { }
func NewLoggingMiddleware ¶
func NewLoggingMiddleware() *LoggingMiddleware
type LoginAccountRequest ¶
type LoginAccountResponse ¶
type MapResponse ¶
type OperationResponseSwagger ¶
type OperationResponseSwagger struct { // in: body Body struct { // error // required: true // example: error occured while processing request Error error `json:"error"` } }
Common operation response swagger:response operationResponse
type PrometheusMiddleware ¶
type PrometheusMiddleware struct { Histogram *core_metrics.HistogramVec Counter *core_metrics.CounterVec }
func NewPrometheusMiddleware ¶
func NewPrometheusMiddleware(m *metrics.CoreMetrics) *PrometheusMiddleware
func (*PrometheusMiddleware) Handler ¶
func (p *PrometheusMiddleware) Handler(next http.Handler) http.Handler
Metrics godoc @Summary Prometheus metrics @Description returns HTTP requests duration and Go runtime metrics @Tags Kubernetes @Produce plain @Router /metrics [get] @Success 200 {string} string "OK"
type RandomDelayMiddleware ¶
type RandomDelayMiddleware struct {
// contains filtered or unexported fields
}
func NewRandomDelayMiddleware ¶
func NewRandomDelayMiddleware(minDelay, maxDelay int, delayUnit string) *RandomDelayMiddleware
type RuntimeResponse ¶
type RuntimeResponse struct { Hostname string `json:"hostname"` Version string `json:"version"` Revision string `json:"revision"` Color string `json:"color"` Logo string `json:"logo"` Message string `json:"message"` GOOS string `json:"goos"` GOARCH string `json:"goarch"` Runtime string `json:"runtime"` NumGoroutine string `json:"num_goroutine"` NumCPU string `json:"num_cpu"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewMockServer ¶
func NewMockServer() *Server
func NewServer ¶
func NewServer(config *Config, client *core_auth_sdk.Client, logging core_logging.ILog, serviceMetrics *metrics.CoreMetrics, metricsEngineConf *core_metrics.CoreMetricsEngine, tracer *core_tracing.TracingEngine) (*Server, error)
func (*Server) ArchiveAccountIfErrorsOccur ¶
func (*Server) DecodeRequestAndInstrument ¶
func (*Server) ErrorResponse ¶
func (*Server) ExtractIdOperationAndInstrument ¶
func (s *Server) ExtractIdOperationAndInstrument(ctx context.Context, r *http.Request, operation string) (uint32, error)
ExtractIdOperationAndInstrument extracts an account id from a request and increments the necessary metrics
func (*Server) IsNotAuthenticated ¶
func (*Server) JSONResponse ¶
func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})
func (*Server) JSONResponseCode ¶
func (*Server) ListenAndServe ¶
func (s *Server) ListenAndServe(stopCh <-chan struct{})
func (*Server) RemoteOperationAndInstrument ¶
type UnLockAccountRequest ¶
type UnLockAccountRequest struct { // id of the account to unlock // in: query // required: true Id uint32 `json:"result"` }
UnLock account request swagger:parameters unlockAccount
type UnLockAccountResponse ¶
type UnLockAccountResponse struct {
Error error `json:"error"`
}
UnLockAccountResponse is struct providing errors tied to Unlock account operations
type UpdateAccountRequest ¶
type UpdateAccountRequest struct {
Email string
}
type UpdateAccountRequestSwagger ¶
type UpdateAccountRequestSwagger struct { // user account to update // in: body Body struct { // Email to update // required: true Email string `json:"email"` } // id of account to update // in: query AccountId uint32 }
Update account request swagger:parameters updateAccount
type UpdateAccountResponse ¶
type UpdateAccountResponse struct {
Error error
}
Source Files
¶
- authn_handler_create_account.go
- authn_handler_delete_account.go
- authn_handler_get_account.go
- authn_handler_lockaccount.go
- authn_handler_login_account.go
- authn_handler_logout_account.go
- authn_handler_unlock_account.go
- authn_handler_update_account.go
- cache.go
- delay.go
- echows.go
- health.go
- http.go
- index.go
- info.go
- logging.go
- metric_helpers.go
- metrics.go
- mock.go
- server.go
- test_helpers.go
- version.go