Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequiredBackup JSON field in /backup/list API call #263

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,12 @@ func (api *APIServer) httpTablesHandler(w http.ResponseWriter, _ *http.Request)
// ??? INSERT INTO system.backup_list (name) VALUES ('backup_name') - create backup
func (api *APIServer) httpListHandler(w http.ResponseWriter, _ *http.Request) {
type backupJSON struct {
Name string `json:"name"`
Created string `json:"created"`
Size int64 `json:"size,omitempty"`
Location string `json:"location"`
Desc string `json:"desc"`
Name string `json:"name"`
Created string `json:"created"`
Size int64 `json:"size,omitempty"`
Location string `json:"location"`
RequiredBackup string `json:"required"`
Desc string `json:"desc"`
}
backupsJSON := make([]backupJSON, 0)
cfg, err := config.LoadConfig(api.configPath)
Expand All @@ -426,11 +427,12 @@ func (api *APIServer) httpListHandler(w http.ResponseWriter, _ *http.Request) {
description = b.Broken
}
backupsJSON = append(backupsJSON, backupJSON{
Name: b.BackupName,
Created: b.CreationDate.Format(APITimeFormat),
Size: b.DataSize + b.MetadataSize,
Location: "local",
Desc: description,
Name: b.BackupName,
Created: b.CreationDate.Format(APITimeFormat),
Size: b.DataSize + b.MetadataSize,
Location: "local",
RequiredBackup: b.RequiredBackup,
Desc: description,
})
}
if cfg.General.RemoteStorage != "none" {
Expand All @@ -448,11 +450,12 @@ func (api *APIServer) httpListHandler(w http.ResponseWriter, _ *http.Request) {
description = b.Broken
}
backupsJSON = append(backupsJSON, backupJSON{
Name: b.BackupName,
Created: b.CreationDate.Format(APITimeFormat),
Size: b.DataSize + b.MetadataSize,
Location: "remote",
Desc: description,
Name: b.BackupName,
Created: b.CreationDate.Format(APITimeFormat),
Size: b.DataSize + b.MetadataSize,
Location: "remote",
RequiredBackup: b.RequiredBackup,
Desc: description,
})
}
}
Expand Down