serverapi

package
v0.3.0-pre10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides helper methods for communicating with Kopia API serevr.

func NewClient

func NewClient(serverAddress string, cli *http.Client) *Client

NewClient creates a client for connecting to Kopia HTTP API.

func (*Client) Get

func (c *Client) Get(path string, respPayload interface{}) error

Get sends HTTP GET request and decodes the JSON response into the provided payload structure.

func (*Client) Post

func (c *Client) Post(path string, reqPayload, respPayload interface{}) error

Post sends HTTP post request with given JSON payload structure and decodes the JSON response into another payload structure.

type Empty

type Empty struct {
}

Empty represents empty request/response.

type MultipleSourceActionResponse

type MultipleSourceActionResponse struct {
	Sources map[string]SourceActionResponse `json:"sources"`
}

MultipleSourceActionResponse contains per-source responses for all sources targeted by API command.

type PoliciesResponse

type PoliciesResponse struct {
	Policies []*PolicyListEntry `json:"policies"`
}

PoliciesResponse is the response of 'policies' HTTP API command.

type PolicyListEntry

type PolicyListEntry struct {
	ID     string              `json:"id"`
	Target snapshot.SourceInfo `json:"target"`
	Policy *policy.Policy      `json:"policy"`
}

PolicyListEntry describes single policy.

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"`
	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"`
}

SourceStatus describes the status of a single source.

type SourcesResponse

type SourcesResponse struct {
	Sources []*SourceStatus `json:"sources"`
}

SourcesResponse is the response of 'sources' HTTP API command.

type StatusResponse

type StatusResponse struct {
	ConfigFile      string                    `json:"configFile"`
	CacheDir        string                    `json:"cacheDir"`
	BlockFormatting content.FormattingOptions `json:"blockFormatting"`
	Storage         string                    `json:"storage"`
}

StatusResponse is the response of 'status' HTTP API command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL