summaryrefslogtreecommitdiff
path: root/http
AgeCommit message (Collapse)AuthorFilesLines
2018-10-04Fix generating HTTP API v1 test fixturesMaciej Wereski7-1/+2
Empty files shouldn't be generated when server responds with '204 No Content'. All such files were removed. Change-Id: I97823f9a476d7699bc5cf88b7da9f342c4b1ac71 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-10-04HTTP API: Change error JSON formatMaciej Wereski31-32/+32
Swagger in case of error passes its details in "message" field in JSON. Change "error" to "message" in Boruta error JSONs to comply with Swagger (which is used in Weles). Change-Id: I6bcbd3355392467696044f304d5b83ccc410c354 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-10-04HTTP API: Change default status code of setWorkerStateHandlerMaciej Wereski3-2/+3
Changing state of worker is long operation which require RPC call to the dryad. workers.SetState() returns nil before such action are finished. Moreover there may occur error after nil was returned. Because of this user should explicitly check if the state of the dryad was changed. Change-Id: I5e15d53598a73e8a5d7dd4014fa97aaa0f8b9e74 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-10-04Fix go vet warnings about usage of unkeyed fieldsLukasz Wojciechowski4-11/+11
Change-Id: Ie30636704b6311c6223d346aeb89da85f20e2028 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-09-05Get rid of dot imports of boruta packageMaciej Wereski6-36/+36
Using dot imports should be avoided. Such imports were left only in some tests. Change-Id: I1d4db1e2b89e2fd8475c8c657ea72b70bba32c5b Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-11Make ReqID and Priority types implement StringeruidockerMaciej Wereski3-14/+11
Change-Id: I3b8e271e38f8b13fa43ded590e1f31c09922bf5d Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-11Merge branch 'httpapi-client'Maciej Wereski10-4/+1768
This branch provides Boruta REST API client package. It implements Requests and Workers interfaces, and provides additional convenient methods to check request/worker state or request timeout. This package is meant for services that want to use Boruta as its device farm (e.g. Weles). Change-Id: I2b116abdcb924f7443fad1c4c5401ba71d8d24fa
2018-07-10HTTP API Client: Add example to documentationhttpapi-clientMaciej Wereski1-0/+80
Change-Id: I73d3b6e53bbae98130af1f0861752f84444e9265 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API: Pass job timeout in HTTP headersMaciej Wereski6-18/+206
Users may want to check timeout value when request gets its resources or access to worker is prolonged. Currently it can be only done with GetRequestInfo() which returns all information about given request. To make this action more convenient HTTP API server will set Boruta-Job-Timeout header when request is in "IN PROGRESS" state. On the client side GetJobTimeout is added. It should be also faster way to obtain timeout value as HEAD method is used instead of GET and there's no JSON parsing. Change-Id: I9533f64be063e97b09c5e378a87968395d6b4072 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Add method to check worker stateMaciej Wereski2-2/+78
GetWorkerState() is convenient method for checking status of worker. It uses HEAD HTTP method, so it's faster than calling GetWorkerInfo and checking boruta.WorkerInfo.State. As HEAD method is used it may be harder to debug when an issue occurs, only HTTP status code is returned. Change-Id: Ie58934e0c520c6033f0ff28e82ea43eb675353a2 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Add method to check request stateMaciej Wereski2-1/+65
GetRequestState() is convenient method for checking status of request. It uses HEAD HTTP method, so it's faster than calling GetRequestInfo and checking boruta.ReqInfo.State. As HEAD method is used it may be harder to debug when an issue occurs, only HTTP status code is returned. Change-Id: Ia2c33e0294e7840d7acec1896090f29c38163913 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Deregister workerMaciej Wereski2-5/+38
Change-Id: I0a622bea2265ffbced657921d8cba03a97053cd9 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Set worker groupsMaciej Wereski2-7/+46
Change-Id: I546f528cd57e88fc9aacaabde447313748dfbdfd Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Set worker stateMaciej Wereski2-7/+45
Change-Id: I96b3e4cab8827dd00fa02f5c4ced3e8b8bc58bff Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Get worker informationMaciej Wereski2-7/+52
Change-Id: Ie0ef143db2e88cf96cef4267c3257223efb0df63 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: List and filter workersMaciej Wereski2-6/+113
Change-Id: I3e3c59c4c7f5a22e97de867daede6587f4673cfc Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Prolong access to workerMaciej Wereski2-5/+38
Change-Id: Icd4ad6dfbdd226a3c6a11bb420488299465bd716 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-10HTTP API Client: Acquire workerMaciej Wereski4-13/+116
Definition of boruta/http.AccessInfo2.Addr had to be changed to specific type (new.TCPAddr) rather than interface, as it's not possible to marshal interface type to JSON. Change-Id: I37afd203db356ba4621ad7448a554b59f6553ce9 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-09HTTP API Client: List and filter requestsMaciej Wereski2-8/+106
Change-Id: I550ebfd6e87b916e15adf39519568b18828d6ae2 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-05HTTP API Client: Get request informationMaciej Wereski2-8/+50
Change-Id: Ic2b18ea346c78b50cf0f6754848a31feb753c253 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-05HTTP API Client: Update requestMaciej Wereski2-4/+80
Change-Id: I7bac5be49bfd0f2a410720ec008c31c5d35cabd1 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-05HTTP API Client: Close requestMaciej Wereski2-12/+45
Change-Id: Ief5f66a3d89bf55694506bbf9f8d8fcb24f51274 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-04HTTP API Client: New requestMaciej Wereski2-24/+447
Change-Id: Id974791f22f96b1408d9bcd0514291c6672cb6ed Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-07-02Add HTTP client package skeletonMaciej Wereski2-0/+275
Client package is intended to be utilized by HTTP API users. It will be more convenient way to interact with Boruta server then directly calling HTTP methods and parsing JSON by hand. Change-Id: Ic27b90fc1559403f56358bd5677c36b2c2e57e71 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-27Make ServerError implement error interfaceMaciej Wereski2-0/+11
Change-Id: Ie804197ca5b777ad6afd2c01d55a853ae8c287ee Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-27HTTP API: Don't loop redirecting when URL wasn't foundMaciej Wereski2-0/+31
Currently when api version isn't provided in URL then request is redirected to default one. If requested resource isn't found there then the redirected will be served by the same handler, so it will be redirected which results in another redirection and so on. This change introduces new handler that responds with 404 error when page wasn't found in default version of API. Change-Id: I1b67f7166d3b0d92500ab2f5727c2827b485d940 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-05Add custom Boruta HTTP headershttpapiMaciej Wereski3-6/+55
This patch introduces two custom Boruta headers to replies for some REST API functions: * Boruta-Request-Status - contains current status of request. It is convenient to request HEAD on GetRequestInfo path to check only status of given request. * Boruta-Request-Count - contains number of requests returned for Request List/Filter operation. * Boruta-Worker-Status - contains current status of worker. * Boruta-Worker-Count - conttains number of workers returned for Worker List/Filter operation. Change-Id: I871c63058b2690bac50046f0dc500c795843b958 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-05HTTP API: Add agregation packageMaciej Wereski7-112/+291
Its purpose is to create and aggregate all Boruta HTTP API version. It also provides handler for panics and redirect ambiguous request to a default API version. Change-Id: Ida94aed412951744557db6c30dd658d36ff3e47e Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-06-05Create new package for http datatypesMaciej Wereski64-0/+1824
Few datatypes will be shared between server and client, such as server errors and filters. Move these datatypes to separate package. Change-Id: I06f025ba8449d2e2c045fbdd84fe59fd76b065ca Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>