From ae7b3ccd5883f0e237059ad848a11ad153a54500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:47:13 +0200 Subject: [PATCH] Add api definition for copying files back from the runner. --- api/swagger.yaml | 105 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 8 deletions(-) diff --git a/api/swagger.yaml b/api/swagger.yaml index 0baeb17..273def3 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -51,6 +51,26 @@ components: - networkAccess - exposedPorts additionalProperties: false + File: + type: object + properties: + name: + description: The path of the file. + type: string + example: ./logs/last.log + size: + description: The size of the file in bytes. + type: integer + example: 42 + modificationTime: + description: The Unix Time Stamp of the last modification. + type: integer + example: 1654201799 + required: + - name + - size + - modificationTime + additionalProperties: false responses: BadRequest: @@ -254,19 +274,54 @@ paths: $ref: "#/components/responses/InternalServerError" /runners/{runnerId}/files: + parameters: + - name: runnerId + in: path + schema: + description: Runner on which the files should be placed + type: string + example: 123e4567-e89b-12d3-a456-426614174000 + required: true + get: + summary: List filesystem. + description: List all files available in the runner. + tags: + - runner + parameters: + - name: recursive + in: query + description: Specify if the filesystem should be listed recursively. + schema: + type: boolean + default: true + required: false + - name: path + in: query + description: Specify the directory from where the filesystem is listed. + schema: + type: string + default: "./" + required: false + responses: + "200": + description: Success. Returns the listing of the runner's filesystem. + content: + application/json: + schema: + type: object + properties: + Files: + description: A list of all Files + type: array + items: + $ref: "#/components/schemas/File" + "401": + $ref: "#/components/responses/Unauthorized" patch: summary: Manipulate runner file system description: Delete the files with the given paths from the file system of the specified runner. Afterwards, copy the enclosed files to the runner. Existing files get overwritten and results of previous file copy operations on the same runner are present when executing multiple requests. tags: - runner - parameters: - - name: runnerId - in: path - schema: - description: Runner on which the files should be placed - type: string - example: 123e4567-e89b-12d3-a456-426614174000 - required: true requestBody: description: Files to copy or delete required: true @@ -312,6 +367,40 @@ paths: "500": $ref: "#/components/responses/InternalServerError" + /runners/{runnerId}/files/raw: + get: + summary: Download the file. + description: Download the specified file from the selected runner. + tags: + - runner + parameters: + - name: runnerId + description: Runner on which the command should be executed + in: path + schema: + type: string + example: 123e4567-e89b-12d3-a456-426614174000 + required: true + - name: path + in: query + description: Specify the file that should be returned by its filename including its path and extension. + schema: + type: string + example: "./flag.txt" + required: true + responses: + "200": + description: Success. Returns the file. + content: + application/octet-stream: + schema: + type: string + format: binary + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + /runners/{runnerId}/execute: post: summary: Execute a command