Files
kopia/internal/serverapi/serverapi.go
Jarek Kowalski ac70a38101 lint: upgraded to 1.22.2 and make lint issues a build failure
fixed or silenced linter warnings, mostly due to magic numeric constants
2020-01-03 16:39:30 -08:00

66 lines
2.1 KiB
Go

// Package serverapi contains GO types corresponding to Kopia server API.
package serverapi
import (
"time"
"github.com/kopia/kopia/repo/content"
"github.com/kopia/kopia/snapshot"
"github.com/kopia/kopia/snapshot/policy"
)
// StatusResponse is the response of 'status' HTTP API command.
type StatusResponse struct {
ConfigFile string `json:"configFile"`
CacheDir string `json:"cacheDir"`
BlockFormatting content.FormattingOptions `json:"blockFormatting"`
Storage string `json:"storage"`
}
// SourcesResponse is the response of 'sources' HTTP API command.
type SourcesResponse struct {
Sources []*SourceStatus `json:"sources"`
}
// SourceStatus describes the status of a single source.
type SourceStatus struct {
Source snapshot.SourceInfo `json:"source"`
Status string `json:"status"`
Policy *policy.Policy `json:"policy"`
LastSnapshotSize int64 `json:"lastSnapshotSize,omitempty"`
LastSnapshotTime time.Time `json:"lastSnapshotTime,omitempty"`
NextSnapshotTime time.Time `json:"nextSnapshotTime,omitempty"`
UploadStatus struct {
UploadingPath string `json:"path,omitempty"`
UploadingPathCompleted int64 `json:"pathCompleted,omitempty"`
UploadingPathTotal int64 `json:"pathTotal,omitempty"`
} `json:"upload"`
}
// PolicyListEntry describes single policy.
type PolicyListEntry struct {
ID string `json:"id"`
Target snapshot.SourceInfo `json:"target"`
Policy *policy.Policy `json:"policy"`
}
// PoliciesResponse is the response of 'policies' HTTP API command.
type PoliciesResponse struct {
Policies []*PolicyListEntry `json:"policies"`
}
// Empty represents empty request/response.
type Empty struct {
}
// SourceActionResponse is a per-source response.
type SourceActionResponse struct {
Success bool `json:"success"`
}
// MultipleSourceActionResponse contains per-source responses for all sources targeted by API command.
type MultipleSourceActionResponse struct {
Sources map[string]SourceActionResponse `json:"sources"`
}