BackupDBS3 creates a backup of the database and stores it in S3. It initializes a BackupManager and performs the backup operation to S3. If any error occurs during backup creation, it responds with an error message. Parameters: - c: The Gin context containing the request and response. Responses: -
(c *gin.Context)
| 58 | // - 400 Bad Request: If there's an error in creating the backup or initializing the BackupManager. |
| 59 | // - 200 OK: If the backup is successfully created and stored in S3. |
| 60 | func (a Api) BackupDBS3(c *gin.Context) { |
| 61 | backupManager, err := backups.NewBackupManager() |
| 62 | if err != nil { |
| 63 | c.JSON(http.StatusBadRequest, gin.H{"error": apierror.NewAPIError(apierror.ErrInternalServer, "error creating backup", err)}) |
| 64 | return |
| 65 | } |
| 66 | err = backupManager.BackupToS3(c.Request.Context()) |
| 67 | if err != nil { |
| 68 | c.JSON(http.StatusBadRequest, gin.H{"error": apierror.NewAPIError(apierror.ErrInternalServer, "error creating backup", err)}) |
| 69 | return |
| 70 | } |
| 71 | c.JSON(http.StatusOK, "backup successful") |
| 72 | } |
nothing calls this directly
no test coverage detected