Documentation ¶
Index ¶
- Variables
- func ErrToStatus(err error) int
- func IsSHA256(s string) bool
- func JSONErrResponse(w http.ResponseWriter, err error, statusCode int)
- func JSONResponse(w http.ResponseWriter, v interface{}, statusCode int)
- func ParseJSONBody(v interface{}, w http.ResponseWriter, r *http.Request) error
- func WSCloseError(conn *websocket.Conn, err error)
- type WebsocketIO
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound indicates an invalid API endpoint was provided ErrNotFound = errors.New("API endpoint not found") // ErrMethodNotAllowed indicates the user tried to use an API with an invalid request method ErrMethodNotAllowed = errors.New("method not allowed on API endpoint") // ErrTokenRequired indicates the user didn't pass an IAM token in the request ErrTokenRequired = errors.New("token required for this endpoint") // ErrAdminRequired indicates that an admin user is required ErrAdminRequired = errors.New("only admin users can make use of this endpoint") // ErrGenericNotFound indicates that a resource was not found ErrGenericNotFound = errors.New("not found") // ErrExists indicates that a resource already exists ErrExists = errors.New("already exists") // ErrUsed indicates that the requested resource is already in use by a webspace ErrUsed = errors.New("used by a webspace") // ErrNotRunning indicates that a webspace is not running ErrNotRunning = errors.New("not running") // ErrRunning indicates that a webspace is already running ErrRunning = errors.New("already running") // ErrDomainUnverified indicates that the request domain could not be verified ErrDomainUnverified = errors.New("verification failed") // ErrDefaultDomain indicates an attempt to remove the default domain ErrDefaultDomain = errors.New("cannot remove the default domain") // ErrTooManyPorts indicates that too many port forwards are configured ErrTooManyPorts = errors.New("port forward limit reached") // ErrBadPort indicates that the provided port is invalid ErrBadPort = errors.New("invalid port") // ErrInterface indicates the default interface is missing ErrInterface = errors.New("default network interface not present") // ErrAddress indicates the interface didn't have an IPv4 address ErrAddress = errors.New("IPv4 address not found") // ErrBadValue indicates an invalid value for a config option ErrBadValue = errors.New("invalid value for configuration option") // ErrUIDMismatch indicates the user ID didn't match that of the User object ErrUIDMismatch = errors.New("user id doesn't match provided value") // ErrTraefikProvider indicates an invalid Traefik config provider name was given ErrTraefikProvider = errors.New("invalid Traefik provider") // ErrWebsocket indicates the endpoint supports websocket communication only ErrWebsocket = errors.New("this endpoint supports websocket communication only") // ErrSSHKey indicates the user requested SSH be set up, but their account does not provide a key ErrSSHKey = errors.New("user has no SSH public key") )
Functions ¶
func ErrToStatus ¶
ErrToStatus converts an error to a HTTP status code
func JSONErrResponse ¶
func JSONErrResponse(w http.ResponseWriter, err error, statusCode int)
JSONErrResponse Sends an `error` as a JSON object with a `message` property
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, v interface{}, statusCode int)
JSONResponse Sends a JSON payload in response to a HTTP request
func ParseJSONBody ¶
func ParseJSONBody(v interface{}, w http.ResponseWriter, r *http.Request) error
ParseJSONBody attempts to parse the request body as JSON
func WSCloseError ¶ added in v0.2.0
WSCloseError closes a websocket with an error message
Types ¶
type WebsocketIO ¶ added in v0.2.0
type WebsocketIO struct { Conn *websocket.Conn Mutex sync.Mutex // contains filtered or unexported fields }
WebsocketIO is a wrapper implementing ReadWriteCloser on top of websocket
func NewWebsocketIO ¶ added in v0.2.0
func NewWebsocketIO(c *websocket.Conn, textHandler func(string, *WebsocketIO)) *WebsocketIO
NewWebsocketIO creates a new websocket ReadWriteCloser wrapper
func (*WebsocketIO) Close ¶ added in v0.2.0
func (w *WebsocketIO) Close() error
Close sends a control message indicating the stream is finished, but it does not actually close the socket.
Click to show internal directories.
Click to hide internal directories.