batches: Remote Mount #3 - HTTP API
Created by: Piszmog
Part of #31792.
Previous part: #40809
Add HTTP API endpoint to upload, retrieve, and check if files exist. Endpoints are included as part of the external services and the executor services.
Overview
The FileHandler
has a single ServerHTTP
function that handles GET
(retrieval), HEAD
(existence check), and POST
(upload). The GET
and HEAD
are nothing unique. POST
on the other hand receives a multipart/form-data
as the request. POST
also has a security check to ensure either a site admin or the creator of the batch spec is uploading the file (not sure if this should apply to all the methods
POST
limits the max size of the request to 10MB (I made this number up). In the future when not using Postgres to store the file content, this can be updated to stream the chunks (there is a comment with a link to an example repo).
Follow up
- Will request a security review after team approval
Test plan
Add Go Unit Tests