http

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package http provides datatypes that are shared between server and client.

Index

Constants

View Source
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.

View Source
const DateFormat = time.RFC3339

DateFormat denotes layout of timestamps used by Boruta HTTP API.

Variables

View Source
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 ReqIDPack

type ReqIDPack struct {
	boruta.ReqID
}

ReqIDPack is used for JSON (un)marshaller.

type RequestFilter

type RequestFilter struct {
	State    string
	Priority string
}

RequestFilter implements ListFilter interface. Currently it is possible to filter by state and priority.

func NewRequestFilter

func NewRequestFilter(state, priority string) *RequestFilter

NewRequestFilter returns pointer to initialized RequestFilter structure.

func (*RequestFilter) Match

func (filter *RequestFilter) Match(req *boruta.ReqInfo) bool

Match is implementation of ListFilter interface. It checks if given ReqInfo matches ListFilter. For now only exact matches are possible, but in the future following functionality should be added: * comparison, * ranges, * one of given, * except of.

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 WorkersFilter

type WorkersFilter struct {
	boruta.Groups
	boruta.Capabilities
}

WorkersFilter contains Groups and Capabilities to be used to filter workers.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL