(e *core.RequestEvent)
| 10 | ) |
| 11 | |
| 12 | func backupCreate(e *core.RequestEvent) error { |
| 13 | if e.App.Store().Has(core.StoreKeyActiveBackup) { |
| 14 | return e.BadRequestError("Try again later - another backup/restore process has already been started", nil) |
| 15 | } |
| 16 | |
| 17 | form := new(backupCreateForm) |
| 18 | form.app = e.App |
| 19 | |
| 20 | err := e.BindBody(form) |
| 21 | if err != nil { |
| 22 | return e.BadRequestError("An error occurred while loading the submitted data.", err) |
| 23 | } |
| 24 | |
| 25 | err = form.validate() |
| 26 | if err != nil { |
| 27 | return e.BadRequestError("An error occurred while validating the submitted data.", err) |
| 28 | } |
| 29 | |
| 30 | err = e.App.CreateBackup(context.Background(), form.Name) |
| 31 | if err != nil { |
| 32 | return e.BadRequestError("Failed to create backup.", err) |
| 33 | } |
| 34 | |
| 35 | // we don't retrieve the generated backup file because it may not be |
| 36 | // available yet due to the eventually consistent nature of some S3 providers |
| 37 | return e.NoContent(http.StatusNoContent) |
| 38 | } |
| 39 | |
| 40 | // ------------------------------------------------------------------- |
| 41 |
nothing calls this directly
no test coverage detected
searching dependent graphs…