Documentation ¶
Overview ¶
Package http provides datatypes that are shared between server and client.
Index ¶
Constants ¶
const ( // ListTotalItemsHdr is HTTP header that is set as part of response to filtering methods. // It contains number of items that match a filter. ListTotalItemsHdr = "Boruta-List-Total" // ListRemainingItemsHdr is HTTP header that is set in response to filtering methods. It contains // number of items that weren't paged through yet. ListRemainingItemsHdr = "Boruta-List-Remaining" // ListBatchSizeHdr is HTTP header that is set in responses to filtering methods. It contains // number of items in the response. ListBatchSizeHdr = "Boruta-List-Batch-Size" // RequestStateHdr is HTTP header that is set in responses that (would) carry boruta.ReqInfo. // It contains state of the request. RequestStateHdr = "Boruta-Request-State" // JobTimeoutHdr is HTTP header that is set in responses that (would) carry boruta.ReqInfo // of request that is in INPROGRESS state. It denotes when timeout will pass and request will // be closed. JobTimeoutHdr = "Boruta-Job-Timeout" // WorkerStateHdr is HTTP header that is set in responses that (would) carry // boruta.WorkerInfo. It contains state of the worker. WorkerStateHdr = "Boruta-Worker-State" // ServerVersionHdr is HTTP header that is set when Boruta version information is requested. // It contains version of the server. ServerVersionHdr = "Boruta-Server-Version" // APIVersionHdr is HTTP header that is set when Boruta version information is requested. It // contains version of the HTTP API. APIVersionHdr = "Boruta-Api-Version" // APIStateHdr is HTTP header that is set when Boruta version information is requested. It // contains state of used API version. APIStateHdr = "Boruta-Api-State" )
Headers returned by Boruta.
const ( // Devel means that API is in active development and changes may occur. Devel = "devel" // Stable means that there won't be any changes in the API. Stable = "stable" // Deprecated means that there is newer stable version of API and this version may be // removed in the future. Deprecated = "deprecated" )
API possible states.
const ( // DateFormat denotes layout of timestamps used by Boruta HTTP API. DateFormat = time.RFC3339 )
Variables ¶
var ( // ErrNotImplemented is returned when requested functionality isn't // implemented yet. ErrNotImplemented = errors.New("not implemented yet") // ErrInternalServerError is returned when serious error in the server // occurs which isn't users' fault. ErrInternalServerError = errors.New("internal server error") // ErrBadRequest is returned when User request is invalid. ErrBadRequest = errors.New("invalid request") // ErrBadID is returned when User provided ID which can't be parsed into // uint. ErrBadID = errors.New("ID provided in URL isn't valid") // ErrBadUUID is returned when User provided ID which isn't valid UUID. ErrBadUUID = errors.New("ID provided in URL isn't valid UUID") // ErrIDMismatch is returned when User provided different ID values in // URL and JSON. ErrIDMismatch = errors.New("request ID set in JSON doesn't match ID from URL") )
Functions ¶
This section is empty.
Types ¶
type AccessInfo2 ¶
type AccessInfo2 struct { // Addr is necessary information to connect to a tunnel to Dryad. Addr *net.TCPAddr // Key is private RSA key in PEM format. Key string // Username is a login name for the job session. Username string }
AccessInfo2 structure is used by HTTP instead of AccessInfo when acquiring worker. The only difference is that key field is in PEM format instead of rsa.PrivateKey. It is temporary solution - session private keys will be replaces with users' public keys when proper user support is added.
type BorutaVersion ¶
type BorutaVersion struct { Server string API string `json:"API_Version"` State string `json:"API_State"` }
BorutaVersion contains information about server and API version.
type RequestsListSpec ¶ added in v0.2.0
type RequestsListSpec struct { // Filter contains information how to filter list of requests. Filter *filter.Requests // Sorter contains SortInfo data. Sorter *boruta.SortInfo // Paginator contains RequestsPaginator. Paginator *boruta.RequestsPaginator }
RequestsListSpec is intended for (un)marshaling ListRequests parameters in HTTP API.
type Response ¶ added in v0.2.0
type Response struct { // Data contains actual content (e.g. pointer to structure, error) that will be marshalled // and passed in HTTP response body. Data interface{} // Additional headers that will be added to HTTP response. Headers http.Header }
Response is desired to be used by HTTP API handlers as a return value.
func NewResponse ¶ added in v0.2.0
NewResponse takes data of any type and http.Headers and prepares pointer to Response structure, which should be returned by HTTP API handler function.
type ServerError ¶
type ServerError struct { // Err contains general error string. Err string `json:"message"` // Status contains HTTP error code that should be returned with the error. Status int `json:"-"` }
ServerError represents error that occured while creating response.
func NewServerError ¶
func NewServerError(err error, details ...string) (ret *ServerError)
NewServerError provides pointer to initialized ServerError.
func (*ServerError) Error ¶
func (err *ServerError) Error() string
Error is implementation of error interface (it returns error string).
type WorkerStatePack ¶
type WorkerStatePack struct {
boruta.WorkerState
}
WorkerStatePack is used by JSON (un)marshaller.
type WorkersListSpec ¶ added in v0.2.0
type WorkersListSpec struct { // Filter contains information how to filter list of workers. Filter *filter.Workers // Sorter contains SortInfo data. Sorter *boruta.SortInfo // Paginator contains WorkersPaginator. Paginator *boruta.WorkersPaginator }
WorkersListSpec is intended for (un)marshaling ListWorkers parameters in HTTP API.
Directories ¶
Path | Synopsis |
---|---|
Package client provides methods for interaction with Boruta REST API server.
|
Package client provides methods for interaction with Boruta REST API server. |
server
|
|
api
Package api aggregates all availabe Boruta HTTP API versions.
|
Package api aggregates all availabe Boruta HTTP API versions. |
api/v1
Package v1 provides HTTP API version 1 of Boruta.
|
Package v1 provides HTTP API version 1 of Boruta. |