Documentation ¶
Overview ¶
Package BlackSpace Backend API.
This serves as the user's microservice api definition for the BlackSpace Platform ¶
Terms Of Service:
there are no TOS at this moment, use at your own risk we take no responsibility
Schemes: http, https Host: localhost BasePath: /v1 Version: 1.0.0 License: MIT http://opensource.org/licenses/MIT Contact: Yoan Yomba<yoanyombapro@gmail.com.com> http://BlackSpace.com Consumes: - application/json Produces: - application/json Security: - api_key: Extensions: x-meta-value: value x-meta-array: - value1 - value2 x-meta-array-obj: - name: obj value: field
swagger:meta
Index ¶
- type ArrayResponse
- type Config
- type DeleteUserByIdRequest
- type FluxConfig
- type GetUserRequestSwagger
- type GetUserResponse
- type GetUserResponseSwagger
- type LoggingMiddleware
- type LoginResponse
- type LoginUserRequest
- type MapResponse
- type OperationResponse
- type OperationResponseSwagger
- type PrometheusMiddleware
- type RuntimeResponse
- type Server
- func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, error string, code int)
- func (s *Server) ExtractJwtFromHeader(r *http.Request) (*utils.TokenValidationResponse, error)
- func (s *Server) ExtractJwtFromRequest(w http.ResponseWriter, r *http.Request) (uint32, error)
- func (s *Server) GenerateAndSignJwtToken(userID uint32, user *models.UserORM) (string, error)
- 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) SignUpHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) UserExistsToAuthService(w http.ResponseWriter, user *models.UserORM) bool
- type SignUpUserRequest
- type SignUpUserResponse
- type UpdateUserRequest
- type UpdateUserRequestSwagger
- type UpdateUserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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"` Port string `mapstructure:"port"` PortMetrics int `mapstructure:"port-metrics"` Hostname string `mapstructure:"hostname"` RandomDelay bool `mapstructure:"random-delay"` RandomError bool `mapstructure:"random-error"` JWTSecret string `mapstructure:"jwt-secret"` JWTSigningAuthority string `mapstructure:"JWT_SIGNER"` IsProduction bool `mapstructure:"IS_PRODUCTION"` }
type DeleteUserByIdRequest ¶
type DeleteUserByIdRequest struct { // id of the user account to delete // in: query // required: true Id uint32 `json:"result"` }
Delete user by id request swagger:parameters deleteUser
type FluxConfig ¶
type GetUserRequestSwagger ¶
type GetUserRequestSwagger struct { // user account to create // in: body Body struct { // id of the user account to get // in: query // required: true Id uint32 `json:"result"` } }
Get user by id request swagger:parameters getUserRequest
type GetUserResponse ¶
type GetUserResponseSwagger ¶
type GetUserResponseSwagger struct { // in: body Body struct { // error // required: true // example: error occured while processing request Error error `json:"error"` // User // required: true User models.UserORM `json:"user"` } }
Common operation response swagger:response getUserResponse
type LoggingMiddleware ¶
type LoggingMiddleware struct {
// contains filtered or unexported fields
}
func NewLoggingMiddleware ¶
func NewLoggingMiddleware(logger *zap.Logger) *LoggingMiddleware
type LoginResponse ¶
type LoginUserRequest ¶
type MapResponse ¶
type OperationResponse ¶
type OperationResponse struct {
Error error `json:"error"`
}
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 *prometheus.HistogramVec Counter *prometheus.CounterVec }
func NewPrometheusMiddleware ¶
func NewPrometheusMiddleware() *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 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 { Auth *authentication.Authentication JwtConfig *authentication.JwtConfiguration Keys *authentication.JsonKeys // contains filtered or unexported fields }
func NewMockServer ¶
func NewMockServer() *Server
func NewServer ¶
func NewServer(config *Config, logger *zap.Logger, db *database.Db, authServiceWrapper *authentication.Authentication) (*Server, error)
func (*Server) ErrorResponse ¶
func (*Server) ExtractJwtFromHeader ¶
func (*Server) ExtractJwtFromRequest ¶
func (*Server) GenerateAndSignJwtToken ¶
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) SignUpHandler ¶
func (s *Server) SignUpHandler(w http.ResponseWriter, r *http.Request)
swagger:route POST /v1/user/signup User signUpUserReq
Sign Up User ¶
creates a user account object in the backend database
Consumes: - application/json - application/x-protobuf Produces: - application/json - application/x-protobuf Schemes: http, https, ws, wss Security: api_key: oauth: read, write
responses:
200: signUpUserResp
400: badRequestError 404: notFoundError 403: forbiddenError 406: genericError 500: internalServerError creates a user account
func (*Server) UserExistsToAuthService ¶
UserExistsToAuthService checks with the authentication wether a user exists or not
type SignUpUserRequest ¶
type SignUpUserResponse ¶
type UpdateUserRequest ¶
type UpdateUserRequestSwagger ¶
type UpdateUserRequestSwagger struct { // user account to create // in: body Body struct { // user to update // required: true User models.User `json:"result"` } // user id of account to update // in: query UserAccountId uint32 }
Update user request swagger:parameters updateUser
type UpdateUserResponse ¶
type UpdateUserResponse struct {
Error error
}