Documentation ¶
Overview ¶
Package serverapi contains GO types corresponding to Kopia server API.
Index ¶
- func ConnectToRepository(ctx context.Context, c *apiclient.KopiaAPIClient, ...) error
- func CreateRepository(ctx context.Context, c *apiclient.KopiaAPIClient, req *CreateRepositoryRequest) error
- func DisconnectFromRepository(ctx context.Context, c *apiclient.KopiaAPIClient) error
- func Estimate(ctx context.Context, c *apiclient.KopiaAPIClient, req *EstimateRequest) (*uitask.Info, error)
- func GetObject(ctx context.Context, c *apiclient.KopiaAPIClient, objectID string) ([]byte, error)
- func GetTask(ctx context.Context, c *apiclient.KopiaAPIClient, taskID string) (*uitask.Info, error)
- func GetThrottlingLimits(ctx context.Context, c *apiclient.KopiaAPIClient) (throttling.Limits, error)
- func Restore(ctx context.Context, c *apiclient.KopiaAPIClient, req *RestoreRequest) (*uitask.Info, error)
- func SetPolicy(ctx context.Context, c *apiclient.KopiaAPIClient, si snapshot.SourceInfo, ...) error
- func SetThrottlingLimits(ctx context.Context, c *apiclient.KopiaAPIClient, l throttling.Limits) error
- func Shutdown(ctx context.Context, c *apiclient.KopiaAPIClient) error
- type APIErrorCode
- type AlgorithmInfo
- type CLIInfo
- type CheckRepositoryExistsRequest
- type ConnectRepositoryRequest
- type CreateRepositoryRequest
- type CreateSnapshotSourceRequest
- type CreateSnapshotSourceResponse
- type CurrentUserResponse
- type DeleteSnapshotsRequest
- type EditSnapshotsRequest
- type Empty
- type ErrorResponse
- type EstimateRequest
- type MountSnapshotRequest
- type MountedSnapshot
- type MountedSnapshots
- type MultipleSourceActionResponse
- type PoliciesResponse
- type PolicyListEntry
- type ResolvePathRequest
- type ResolvePathResponse
- type ResolvePolicyRequest
- type ResolvePolicyResponse
- type RestoreRequest
- type Snapshot
- type SnapshotsResponse
- type SourceActionResponse
- type SourceStatus
- type SourcesResponse
- type StatusResponse
- type SupportedAlgorithmsResponse
- type TaskListResponse
- type TaskLogResponse
- type UIPreferences
- type UnmountSnapshotRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToRepository ¶ added in v0.6.0
func ConnectToRepository(ctx context.Context, c *apiclient.KopiaAPIClient, req *ConnectRepositoryRequest) error
ConnectToRepository invokes the 'repo/connect' API.
func CreateRepository ¶ added in v0.6.0
func CreateRepository(ctx context.Context, c *apiclient.KopiaAPIClient, req *CreateRepositoryRequest) error
CreateRepository invokes the 'repo/create' API.
func DisconnectFromRepository ¶ added in v0.6.0
func DisconnectFromRepository(ctx context.Context, c *apiclient.KopiaAPIClient) error
DisconnectFromRepository invokes the 'repo/disconnect' API.
func Estimate ¶ added in v0.9.0
func Estimate(ctx context.Context, c *apiclient.KopiaAPIClient, req *EstimateRequest) (*uitask.Info, error)
Estimate starts snapshot estimation task for a given directory.
func GetThrottlingLimits ¶ added in v0.9.6
func GetThrottlingLimits(ctx context.Context, c *apiclient.KopiaAPIClient) (throttling.Limits, error)
GetThrottlingLimits gets the throttling limits.
func Restore ¶ added in v0.11.3
func Restore(ctx context.Context, c *apiclient.KopiaAPIClient, req *RestoreRequest) (*uitask.Info, error)
Restore starts snapshot restore task for a given directory.
func SetPolicy ¶ added in v0.9.6
func SetPolicy(ctx context.Context, c *apiclient.KopiaAPIClient, si snapshot.SourceInfo, pol *policy.Policy) error
SetPolicy sets the policy.
func SetThrottlingLimits ¶ added in v0.9.6
func SetThrottlingLimits(ctx context.Context, c *apiclient.KopiaAPIClient, l throttling.Limits) error
SetThrottlingLimits sets the throttling limits.
Types ¶
type APIErrorCode ¶ added in v0.5.2
type APIErrorCode string
APIErrorCode indicates machine-readable error code returned in API responses.
const ( ErrorInternal APIErrorCode = "INTERNAL" ErrorAlreadyConnected APIErrorCode = "ALREADY_CONNECTED" ErrorAlreadyInitialized APIErrorCode = "ALREADY_INITIALIZED" ErrorInvalidPassword APIErrorCode = "INVALID_PASSWORD" ErrorInvalidToken APIErrorCode = "INVALID_TOKEN" ErrorMalformedRequest APIErrorCode = "MALFORMED_REQUEST" ErrorNotConnected APIErrorCode = "NOT_CONNECTED" ErrorNotFound APIErrorCode = "NOT_FOUND" ErrorNotInitialized APIErrorCode = "NOT_INITIALIZED" ErrorPathNotFound APIErrorCode = "PATH_NOT_FOUND" ErrorStorageConnection APIErrorCode = "STORAGE_CONNECTION" ErrorAccessDenied APIErrorCode = "ACCESS_DENIED" )
Supported error codes.
type AlgorithmInfo ¶ added in v0.11.0
AlgorithmInfo is an information about a single algorithm.
type CLIInfo ¶ added in v0.9.7
type CLIInfo struct {
Executable string `json:"executable"`
}
CLIInfo contains CLI information.
type CheckRepositoryExistsRequest ¶ added in v0.7.0
type CheckRepositoryExistsRequest struct {
Storage blob.ConnectionInfo `json:"storage"`
}
CheckRepositoryExistsRequest returns success if a repository exists in a given storage, ErrorNotInitialized if not.
type ConnectRepositoryRequest ¶ added in v0.5.2
type ConnectRepositoryRequest struct { Storage blob.ConnectionInfo `json:"storage"` Password string `json:"password"` Token string `json:"token"` // when set, overrides Storage and Password APIServer *repo.APIServerInfo `json:"apiServer"` ClientOptions repo.ClientOptions `json:"clientOptions"` SyncWaitTimeSeconds int `json:"syncWaitTime"` // if non-zero, force particular wait time, negative == forever }
ConnectRepositoryRequest contains request to connect to a repository.
type CreateRepositoryRequest ¶ added in v0.5.2
type CreateRepositoryRequest struct { ConnectRepositoryRequest NewRepositoryOptions repo.NewRepositoryOptions `json:"options"` }
CreateRepositoryRequest contains request to create a repository in a given storage.
type CreateSnapshotSourceRequest ¶ added in v0.5.2
type CreateSnapshotSourceRequest struct { Path string `json:"path"` CreateSnapshot bool `json:"createSnapshot"` Policy *policy.Policy `json:"policy"` // policy to set on the path }
CreateSnapshotSourceRequest contains request to create snapshot source and optionally create first snapshot.
type CreateSnapshotSourceResponse ¶ added in v0.5.2
type CreateSnapshotSourceResponse struct {
SnapshotStarted bool `json:"snapshotted"` // whether snapshotting has been started
}
CreateSnapshotSourceResponse contains response of creating snapshot source.
func CreateSnapshotSource ¶ added in v0.6.0
func CreateSnapshotSource(ctx context.Context, c *apiclient.KopiaAPIClient, req *CreateSnapshotSourceRequest) (*CreateSnapshotSourceResponse, error)
CreateSnapshotSource creates snapshot source with a given path.
type CurrentUserResponse ¶ added in v0.7.0
type CurrentUserResponse struct { Username string `json:"username"` Hostname string `json:"hostname"` }
CurrentUserResponse is the response of 'current-user' HTTP API command.
type DeleteSnapshotsRequest ¶ added in v0.10.5
type DeleteSnapshotsRequest struct { SourceInfo snapshot.SourceInfo `json:"source"` SnapshotManifestIDs []manifest.ID `json:"snapshotManifestIds"` DeleteSourceAndPolicy bool `json:"deleteSourceAndPolicy"` }
DeleteSnapshotsRequest contains request to delete a number of snapshots and optionally the entire snapshot source.
type EditSnapshotsRequest ¶ added in v0.10.5
type EditSnapshotsRequest struct { Snapshots []manifest.ID `json:"snapshots"` NewDescription *string `json:"description"` AddPins []string `json:"addPins"` RemovePins []string `json:"removePins"` }
EditSnapshotsRequest contains request to edit one or more snapshots.
type ErrorResponse ¶ added in v0.5.2
type ErrorResponse struct { Code APIErrorCode `json:"code"` Error string `json:"error"` }
ErrorResponse represents error response.
type EstimateRequest ¶ added in v0.8.0
type EstimateRequest struct { Root string `json:"root"` MaxExamplesPerBucket int `json:"maxExamplesPerBucket"` PolicyOverride *policy.Policy `json:"policyOverride"` }
EstimateRequest contains request to estimate the size of the snapshot in a given root.
type MountSnapshotRequest ¶ added in v0.7.0
type MountSnapshotRequest struct {
Root string `json:"root"`
}
MountSnapshotRequest contains request to mount a snapshot.
type MountedSnapshot ¶ added in v0.7.0
MountedSnapshot describes single mounted snapshot.
type MountedSnapshots ¶ added in v0.7.0
type MountedSnapshots struct {
Items []*MountedSnapshot `json:"items"`
}
MountedSnapshots describes single mounted snapshot.
type MultipleSourceActionResponse ¶
type MultipleSourceActionResponse struct {
Sources map[string]SourceActionResponse `json:"sources"`
}
MultipleSourceActionResponse contains per-source responses for all sources targeted by API command.
func CancelUpload ¶ added in v0.6.0
func CancelUpload(ctx context.Context, c *apiclient.KopiaAPIClient, match *snapshot.SourceInfo) (*MultipleSourceActionResponse, error)
CancelUpload cancels snapshot upload on matching snapshots.
func UploadSnapshots ¶ added in v0.6.0
func UploadSnapshots(ctx context.Context, c *apiclient.KopiaAPIClient, match *snapshot.SourceInfo) (*MultipleSourceActionResponse, error)
UploadSnapshots triggers snapshot upload on matching snapshots.
type PoliciesResponse ¶
type PoliciesResponse struct {
Policies []*PolicyListEntry `json:"policies"`
}
PoliciesResponse is the response of 'policies' HTTP API command.
func ListPolicies ¶ added in v0.6.0
func ListPolicies(ctx context.Context, c *apiclient.KopiaAPIClient, match *snapshot.SourceInfo) (*PoliciesResponse, error)
ListPolicies lists the policies managed by the server for a given target filter.
type PolicyListEntry ¶
type PolicyListEntry struct { ID string `json:"id"` Target snapshot.SourceInfo `json:"target"` Policy *policy.Policy `json:"policy"` }
PolicyListEntry describes single policy.
type ResolvePathRequest ¶ added in v0.9.7
type ResolvePathRequest struct {
Path string `json:"path"`
}
ResolvePathRequest contains request to resolve a particular path to ResolvePathResponse.
type ResolvePathResponse ¶ added in v0.9.7
type ResolvePathResponse struct {
SourceInfo snapshot.SourceInfo `json:"source"`
}
ResolvePathResponse contains response to resolve a particular path.
type ResolvePolicyRequest ¶ added in v0.9.7
type ResolvePolicyRequest struct { Updates *policy.Policy `json:"updates"` NumUpcomingSnapshotTimes int `json:"numUpcomingSnapshotTimes"` // if > 0, return N UpcomingSnapshotTimes }
ResolvePolicyRequest contains request structure to ResolvePolicy.
type ResolvePolicyResponse ¶ added in v0.9.7
type ResolvePolicyResponse struct { Effective *policy.Policy `json:"effective"` Definition *policy.Definition `json:"definition"` Defined *policy.Policy `json:"defined"` UpcomingSnapshotTimes []time.Time `json:"upcomingSnapshotTimes"` }
ResolvePolicyResponse returns the resolved details about a single policy.
func ResolvePolicy ¶ added in v0.9.7
func ResolvePolicy(ctx context.Context, c *apiclient.KopiaAPIClient, si snapshot.SourceInfo, req *ResolvePolicyRequest) (*ResolvePolicyResponse, error)
ResolvePolicy resolves the policy.
type RestoreRequest ¶ added in v0.8.0
type RestoreRequest struct { Root string `json:"root"` Filesystem *restore.FilesystemOutput `json:"fsOutput"` ZipFile string `json:"zipFile"` UncompressedZip bool `json:"uncompressedZip"` TarFile string `json:"tarFile"` Options restore.Options `json:"options"` }
RestoreRequest contains request to restore an object (file or directory) to a given destination.
type Snapshot ¶ added in v0.5.2
type Snapshot struct { ID manifest.ID `json:"id"` Description string `json:"description"` StartTime fs.UTCTimestamp `json:"startTime"` EndTime fs.UTCTimestamp `json:"endTime"` IncompleteReason string `json:"incomplete,omitempty"` Summary *fs.DirectorySummary `json:"summary"` RootEntry string `json:"rootID"` RetentionReasons []string `json:"retention"` Pins []string `json:"pins"` }
Snapshot describes single snapshot entry.
type SnapshotsResponse ¶ added in v0.5.2
type SnapshotsResponse struct { Snapshots []*Snapshot `json:"snapshots"` UnfilteredCount int `json:"unfilteredCount"` UniqueCount int `json:"uniqueCount"` }
SnapshotsResponse contains a list of snapshots.
func ListSnapshots ¶ added in v0.6.0
func ListSnapshots(ctx context.Context, c *apiclient.KopiaAPIClient, src snapshot.SourceInfo, all bool) (*SnapshotsResponse, error)
ListSnapshots lists the snapshots managed by the server for a given source source.
type SourceActionResponse ¶
type SourceActionResponse struct {
Success bool `json:"success"`
}
SourceActionResponse is a per-source response.
type SourceStatus ¶
type SourceStatus struct { Source snapshot.SourceInfo `json:"source"` Status string `json:"status"` SchedulingPolicy policy.SchedulingPolicy `json:"schedule"` LastSnapshot *snapshot.Manifest `json:"lastSnapshot,omitempty"` NextSnapshotTime *time.Time `json:"nextSnapshotTime,omitempty"` UploadCounters *snapshotfs.UploadCounters `json:"upload,omitempty"` CurrentTask string `json:"currentTask,omitempty"` }
SourceStatus describes the status of a single source.
type SourcesResponse ¶
type SourcesResponse struct { LocalUsername string `json:"localUsername"` LocalHost string `json:"localHost"` // if set to true, current repository supports accessing data for other users. MultiUser bool `json:"multiUser"` Sources []*SourceStatus `json:"sources"` }
SourcesResponse is the response of 'sources' HTTP API command.
func ListSources ¶ added in v0.6.0
func ListSources(ctx context.Context, c *apiclient.KopiaAPIClient, match *snapshot.SourceInfo) (*SourcesResponse, error)
ListSources lists the snapshot sources managed by the server.
type StatusResponse ¶
type StatusResponse struct { Connected bool `json:"connected"` ConfigFile string `json:"configFile,omitempty"` FormatVersion format.Version `json:"formatVersion,omitempty"` Hash string `json:"hash,omitempty"` Encryption string `json:"encryption,omitempty"` ECC string `json:"ecc,omitempty"` ECCOverheadPercent int `json:"eccOverheadPercent,omitempty"` Splitter string `json:"splitter,omitempty"` MaxPackSize int `json:"maxPackSize,omitempty"` Storage string `json:"storage,omitempty"` APIServerURL string `json:"apiServerURL,omitempty"` SupportsContentCompression bool `json:"supportsContentCompression"` repo.ClientOptions // non-empty while the repository is being initialized (opened, created or connected). InitRepoTaskID string `json:"initTaskID,omitempty"` }
StatusResponse is the response of 'status' HTTP API command.
func RepoStatus ¶ added in v0.10.1
func RepoStatus(ctx context.Context, c *apiclient.KopiaAPIClient) (*StatusResponse, error)
RepoStatus invokes the 'repo/status' API.
func Status ¶ added in v0.6.0
func Status(ctx context.Context, c *apiclient.KopiaAPIClient) (*StatusResponse, error)
Status invokes the 'control/status' API.
type SupportedAlgorithmsResponse ¶ added in v0.5.2
type SupportedAlgorithmsResponse struct { DefaultHashAlgorithm string `json:"defaultHash"` DefaultEncryptionAlgorithm string `json:"defaultEncryption"` DefaultECCAlgorithm string `json:"defaultEcc"` DefaultSplitterAlgorithm string `json:"defaultSplitter"` SupportedHashAlgorithms []AlgorithmInfo `json:"hash"` SupportedEncryptionAlgorithms []AlgorithmInfo `json:"encryption"` SupportedECCAlgorithms []AlgorithmInfo `json:"ecc"` SupportedSplitterAlgorithms []AlgorithmInfo `json:"splitter"` SupportedCompressionAlgorithms []AlgorithmInfo `json:"compression"` }
SupportedAlgorithmsResponse returns the list of supported algorithms for repository creation.
type TaskListResponse ¶ added in v0.8.0
TaskListResponse contains a list of tasks.
func ListTasks ¶ added in v0.9.6
func ListTasks(ctx context.Context, c *apiclient.KopiaAPIClient) (*TaskListResponse, error)
ListTasks lists the tasks.
type TaskLogResponse ¶ added in v0.8.0
type TaskLogResponse struct {
Logs []json.RawMessage `json:"logs"` // formatted as uitask.LogEntry
}
TaskLogResponse contains a task log.
type UIPreferences ¶ added in v0.9.8
type UIPreferences struct { BytesStringBase2 bool `json:"bytesStringBase2"` // If `true`, display storage values in base-2 (default is base-10) Theme string `json:"theme"` // 'dark', 'light' or ” PageSize int `json:"pageSize"` // A page size; the actual possible values will only be provided by the frontend }
UIPreferences represents JSON object storing UI preferences.
type UnmountSnapshotRequest ¶ added in v0.7.0
type UnmountSnapshotRequest struct {
Root string `json:"root"`
}
UnmountSnapshotRequest contains request to unmount a snapshot.