MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / BackupDBS3

Method BackupDBS3

api/admin.go:60–72  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
60func (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}

Callers

nothing calls this directly

Calls 2

BackupToS3Method · 0.95
NewAPIErrorFunction · 0.92

Tested by

no test coverage detected