Implement runners execute route

Co-authored-by: Tobias Kantusch <tobias.kantusch@student.hpi.uni-potsdam.de>
This commit is contained in:
Konrad Hanff
2021-04-30 16:21:44 +02:00
parent c571d4635d
commit 6a00ea3165
7 changed files with 177 additions and 362 deletions

View File

@@ -1,28 +1,40 @@
package dto
// RequestRunner is the expected json structure of the request body for the ProvideRunner function
type RequestRunner struct {
// RunnerRequest is the expected json structure of the request body for the ProvideRunner function.
type RunnerRequest struct {
ExecutionEnvironmentId int `json:"executionEnvironmentId"`
InactivityTimeout int `json:"inactivityTimeout"`
}
// ResponseRunner is the expected result from the api server
type ResponseRunner struct {
// ExecutionRequest is the expected json structure of the request body for the ExecuteCommand function.
type ExecutionRequest struct {
Command string
TimeLimit int
Environment map[string]string
}
// RunnerResponse is the expected response when providing a runner.
type RunnerResponse struct {
Id string `json:"runnerId"`
}
// ClientError is the response interface if the request is not valid
// WebsocketResponse is the expected response when creating an execution for a runner.
type WebsocketResponse struct {
WebsocketUrl string
}
// ClientError is the response interface if the request is not valid.
type ClientError struct {
Message string `json:"message"`
}
// InternalServerError is the response interface that is returned when an error occurs
// InternalServerError is the response interface that is returned when an error occurs.
type InternalServerError struct {
Message string `json:"message"`
ErrorCode ErrorCode `json:"errorCode"`
}
// ErrorCode is the type for error codes expected by CodeOcean
// ErrorCode is the type for error codes expected by CodeOcean.
type ErrorCode string
const (