Documentation
¶
Index ¶
- func SetupRouter(apiHandler *APIHandler) *chi.Mux
- type APIHandler
- func (a *APIHandler) HandleAddBackupRepoStorage(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleCreateBackupRepo(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleCreateStorage(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleDeleteBackupRepo(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleDeleteStorage(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleGetBackupRepoByName(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleGetBackupRepoStorages(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleGetBackupRepos(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleGetStorageByName(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleGetStorages(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleIndex(w http.ResponseWriter, r *http.Request)
- func (a *APIHandler) HandleRemoveBackupRepoStorage(w http.ResponseWriter, r *http.Request)
- type SuccessResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupRouter ¶
func SetupRouter(apiHandler *APIHandler) *chi.Mux
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
func NewAPIHandler ¶
func NewAPIHandler(db *database.Database, bm *backuprepo.BackupRepoManager, sm *storage.StorageManager, scheduler *backup.BackupScheduler, templatesDir string) *APIHandler
func (*APIHandler) HandleAddBackupRepoStorage ¶ added in v0.3.0
func (a *APIHandler) HandleAddBackupRepoStorage(w http.ResponseWriter, r *http.Request)
@Summary Add storage to backup repository @Description Associate a storage with a backup repository by their names @Tags backup-repositories @Param repo_name path string true "Name of the backup repository" @Param storage_name path string true "Name of the storage" @Success 200 {object} SuccessResponse "Success response" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /repository/{repo_name}/storage/{storage_name} [post]
func (*APIHandler) HandleCreateBackupRepo ¶
func (a *APIHandler) HandleCreateBackupRepo(w http.ResponseWriter, r *http.Request)
@Summary Create a new backup repository configuration @Description Create a new backup repository configuration with the given data @Tags backup-repositories @Accept json @Produce json @Param backupRepo body backuprepo.BackupRepo true "Backup repository data" @Success 200 {object} SuccessResponse "Success response"“ @Failure 400 {string} string "Invalid request body" @Failure 500 {string} string "Internal Server Error" @Router /repository [post]
func (*APIHandler) HandleCreateStorage ¶ added in v0.3.0
func (a *APIHandler) HandleCreateStorage(w http.ResponseWriter, r *http.Request)
@Summary Create storage @Description Create a new storage configuration @Tags storages @Accept json @Produce json @Param storage_type path string true "Storage type (s3)" Enums(s3) @Param storage body storage.S3Storage true "Storage configuration to create" @Success 200 {object} SuccessResponse "Success response" @Failure 400 {string} string "Bad Request" @Failure 500 {string} string "Internal Server Error" @Router /storage/{storage_type} [post]
func (*APIHandler) HandleDeleteBackupRepo ¶ added in v0.3.0
func (a *APIHandler) HandleDeleteBackupRepo(w http.ResponseWriter, r *http.Request)
@Summary Delete a backup repository @Description Delete a backup repository by its name @Tags backup-repositories @Param repo_name path string true "Name of the backup repository to delete" @Success 200 {object} SuccessResponse "Success response" @Failure 500 {string} string "Internal Server Error" @Router /repository/{repo_name} [delete]
func (*APIHandler) HandleDeleteStorage ¶ added in v0.3.0
func (a *APIHandler) HandleDeleteStorage(w http.ResponseWriter, r *http.Request)
@Summary Delete storage @Description Delete the storage configuration by its name @Tags storages @Param storage_conf path string true "Name of the storage" @Produce json @Success 200 {object} SuccessResponse "Success response" @Failure 500 {string} string "Internal Server Error" @Router /storage/{storage_conf} [delete]
func (*APIHandler) HandleGetBackupRepoByName ¶
func (a *APIHandler) HandleGetBackupRepoByName(w http.ResponseWriter, r *http.Request)
@Summary Get a backup repository by name @Description Get the backup repository with the given name @Tags backup-repositories @Accept json @Produce json @Param repo_name path string true "Name of the backup repository to retrieve" @Success 200 {object} backuprepo.BackupRepo "Backup repository data" @Failure 404 {string} string "Backup repository not found" @Failure 500 {string} string "Internal Server Error" @Router /repository/{repo_name} [get]
func (*APIHandler) HandleGetBackupRepoStorages ¶ added in v0.3.0
func (a *APIHandler) HandleGetBackupRepoStorages(w http.ResponseWriter, r *http.Request)
@Summary Get backup repository storages @Description Get all storages associated with a backup repository by its name @Tags backup-repositories @Param repo_name path string true "Name of the backup repository" @Success 200 {array} storage.Storage "List of storages associated with the backup repository" @Failure 500 {string} string "Internal Server Error" @Router /repository/{repo_name}/storage/ [get]
func (*APIHandler) HandleGetBackupRepos ¶
func (a *APIHandler) HandleGetBackupRepos(w http.ResponseWriter, r *http.Request)
@Summary Get all backup repositories @Description Get a list of all backup repositories @Tags backup-repositories @Accept json @Produce json @Success 200 {array} backuprepo.BackupRepo "List of backup repositories" @Failure 500 {string} string "Internal Server Error" @Router /repository [get]
func (*APIHandler) HandleGetStorageByName ¶ added in v0.3.0
func (a *APIHandler) HandleGetStorageByName(w http.ResponseWriter, r *http.Request)
@Summary Get storage by name @Description Get the storage configuration by its name @Tags storages @Param storage_conf path string true "Name of the storage" @Produce json @Success 200 {object} storage.Storage "Storage configuration" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /storage/{storage_conf} [get]
func (*APIHandler) HandleGetStorages ¶ added in v0.3.0
func (a *APIHandler) HandleGetStorages(w http.ResponseWriter, r *http.Request)
@Description Get all storage configurations @Tags storages @Produce json @Success 200 {array} storage.Storage "List of all storage configurations" @Failure 500 {string} string "Internal Server Error" @Router /storage/ [get]
func (*APIHandler) HandleIndex ¶
func (a *APIHandler) HandleIndex(w http.ResponseWriter, r *http.Request)
func (*APIHandler) HandleRemoveBackupRepoStorage ¶ added in v0.3.0
func (a *APIHandler) HandleRemoveBackupRepoStorage(w http.ResponseWriter, r *http.Request)
@Summary Remove storage from backup repository @Description Remove the association between a storage and a backup repository by their names @Tags backup-repositories @Param repo_name path string true "Name of the backup repository" @Param storage_name path string true "Name of the storage" @Success 200 {object} SuccessResponse "Success response" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /repository/{repo_name}/storage/{storage_name} [delete]
type SuccessResponse ¶ added in v0.4.0
type SuccessResponse struct {
Message string `json:"message"`
}