mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 06:48:48 -05:00
Support for remote content repository where all contents and manifests are fetched over HTTP(S) instead of locally manipulating blob storage * server: implement content and manifest access APIs * apiclient: moved Kopia API client to separate package * content: exposed content.ValidatePrefix() * manifest: added JSON serialization attributes to EntryMetadata * repo: changed repo.Open() to return Repository instead of *DirectRepository * repo: added apiServerRepository * cli: added 'kopia repository connect server' This sets up repository connection via the API server instead of directly-manipulated storage. * server: add support for specifying a list of usernames/password via --htpasswd-file * tests: added API server repository E2E test * server: only return manifests (policies and snapshots) belonging to authenticated user
26 lines
570 B
Go
26 lines
570 B
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
)
|
|
|
|
type apiError struct {
|
|
httpErrorCode int
|
|
apiErrorCode serverapi.APIErrorCode
|
|
message string
|
|
}
|
|
|
|
func requestError(apiErrorCode serverapi.APIErrorCode, message string) *apiError {
|
|
return &apiError{400, apiErrorCode, message}
|
|
}
|
|
|
|
func notFoundError(message string) *apiError {
|
|
return &apiError{404, serverapi.ErrorNotFound, message}
|
|
}
|
|
|
|
func internalServerError(err error) *apiError {
|
|
return &apiError{500, serverapi.ErrorInternal, fmt.Sprintf("internal server error: %v", err)}
|
|
}
|