Documentation ¶
Overview ¶
https://github.com/topfreegames/mystack-controller
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license Copyright © 2017 Top Free Games <backend@tfgco.com>
Index ¶
- func Chain(f http.Handler, middlewares ...Middleware) http.Handler
- func CopyConn(dst, src net.Conn)
- func GetClusterName(r *http.Request) string
- func NewContextWithClusterConfig(ctx context.Context, clusterConfig string) context.Context
- func NewContextWithEmail(ctx context.Context, email string) context.Context
- func Proxy(remoteConn, clientConn net.Conn, logger logrus.FieldLogger)
- func Read(conn net.Conn, logger logrus.FieldLogger) (string, string, error)
- func Status(err error) int
- func Write(w http.ResponseWriter, status int, text string)
- func WriteBytes(w http.ResponseWriter, status int, text []byte)
- type AccessMiddleware
- type App
- type ClusterConfigHandler
- type ClusterHandler
- type HealthcheckHandler
- type LoggingMiddleware
- type LoginHandler
- type Middleware
- type PayloadMiddleware
- type UserHandler
- type VersionMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
func Chain(f http.Handler, middlewares ...Middleware) http.Handler
Chain applies middlewares to a http.HandlerFunc
func GetClusterName ¶
GetClusterName gets the name from URL from request
func NewContextWithClusterConfig ¶
NewContextWithClusterConfig creates a context with cluster config
func NewContextWithEmail ¶
NewContextWithEmail save email on context
func Write ¶
func Write(w http.ResponseWriter, status int, text string)
Write to the response and with the status code
func WriteBytes ¶
func WriteBytes(w http.ResponseWriter, status int, text []byte)
WriteBytes to the response and with the status code
Types ¶
type AccessMiddleware ¶
type AccessMiddleware struct { App *App // contains filtered or unexported fields }
AccessMiddleware guarantees that the user is logged
func NewAccessMiddleware ¶ added in v0.4.4
func NewAccessMiddleware(app *App) *AccessMiddleware
NewAccessMiddleware is the AccessMiddleware constructor
func (*AccessMiddleware) ServeHTTP ¶
func (m *AccessMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP methods
func (*AccessMiddleware) SetNext ¶
func (m *AccessMiddleware) SetNext(next http.Handler)
SetNext handler
type App ¶
type App struct { Address string Config *viper.Viper DB models.DB Debug bool Logger logrus.FieldLogger Router *mux.Router Server *http.Server EmailDomain []string K8sDomain string Clientset kubernetes.Interface DeploymentReadiness models.Readiness JobReadiness models.Readiness }
App is our API application
func NewApp ¶
func NewApp( host string, port int, config *viper.Viper, debug bool, logger logrus.FieldLogger, clientset kubernetes.Interface, ) (*App, error)
NewApp ctor
func (*App) HandleError ¶
func (a *App) HandleError(w http.ResponseWriter, status int, msg string, err interface{})
HandleError writes an error response with message and status
type ClusterConfigHandler ¶
ClusterConfigHandler handles cluster creation and deletion
func (*ClusterConfigHandler) ServeHTTP ¶
func (c *ClusterConfigHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ClusterHandler ¶
ClusterHandler handles cluster creation and deletion
func (*ClusterHandler) ServeHTTP ¶
func (c *ClusterHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HealthcheckHandler ¶
type HealthcheckHandler struct {
App *App
}
HealthcheckHandler handler
func (*HealthcheckHandler) ServeHTTP ¶
func (h *HealthcheckHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
type LoggingMiddleware ¶
LoggingMiddleware handles logging
func (*LoggingMiddleware) ServeHTTP ¶
func (m *LoggingMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
func (*LoggingMiddleware) SetNext ¶
func (m *LoggingMiddleware) SetNext(next http.Handler)
SetNext middleware
type LoginHandler ¶
LoginHandler handles login url requests
func (*LoginHandler) ServeHTTP ¶
func (l *LoginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
type Middleware ¶
Middleware contract
type PayloadMiddleware ¶
type PayloadMiddleware struct { App *App // contains filtered or unexported fields }
PayloadMiddleware handles cluster creation and deletion
func (*PayloadMiddleware) ServeHTTP ¶
func (p *PayloadMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*PayloadMiddleware) SetNext ¶
func (p *PayloadMiddleware) SetNext(next http.Handler)
SetNext handler
type UserHandler ¶ added in v0.2.0
type UserHandler struct {
App *App
}
UserHandler handles login url requests
func (*UserHandler) ServeHTTP ¶ added in v0.2.0
func (u *UserHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
type VersionMiddleware ¶
type VersionMiddleware struct {
// contains filtered or unexported fields
}
VersionMiddleware adds the version to the request
func (*VersionMiddleware) ServeHTTP ¶
func (m *VersionMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
func (*VersionMiddleware) SetNext ¶
func (m *VersionMiddleware) SetNext(next http.Handler)
SetNext handler