api

package
v6.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 16, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthToken added in v0.6.4

func BasicAuthToken(user, password string) string

func CancelTask

func CancelTask(id uuid.UUID) error

func DeleteArchive

func DeleteArchive(id uuid.UUID) error

func DeleteJob

func DeleteJob(id uuid.UUID) error

func DeleteRetentionPolicy

func DeleteRetentionPolicy(id uuid.UUID) error

func DeleteSchedule

func DeleteSchedule(id uuid.UUID) error

func DeleteStore

func DeleteStore(id uuid.UUID) error

func DeleteTarget

func DeleteTarget(id uuid.UUID) error

func IsPausedJob

func IsPausedJob(id uuid.UUID) (bool, error)

func LoadConfig added in v0.6.4

func LoadConfig(p string) error

func PauseJob

func PauseJob(id uuid.UUID) error

func RestoreArchive

func RestoreArchive(id uuid.UUID, targetJSON string) error

func RunJob

func RunJob(id uuid.UUID, ownerJSON string) error

func UnpauseJob

func UnpauseJob(id uuid.UUID) error

Types

type Archive

type Archive struct {
	UUID      string    `json:"uuid"`
	StoreKey  string    `json:"key"`
	TakenAt   Timestamp `json:"taken_at"`
	ExpiresAt Timestamp `json:"expires_at"`
	Status    string    `json:"status"`
	Notes     string    `json:"notes"`

	TargetUUID     string `json:"target_uuid"`
	TargetPlugin   string `json:"target_plugin"`
	TargetEndpoint string `json:"target_endpoint"`
	StoreUUID      string `json:"store_uuid"`
	StorePlugin    string `json:"store_plugin"`
	StoreEndpoint  string `json:"store_endpoint"`
}

func GetArchive

func GetArchive(id uuid.UUID) (Archive, error)

func GetArchives

func GetArchives(filter ArchiveFilter) ([]Archive, error)

func UpdateArchive

func UpdateArchive(id uuid.UUID, contentJSON string) (Archive, error)

type ArchiveFilter

type ArchiveFilter struct {
	Target string
	Store  string
	Before string
	After  string
	Status string
	Limit  string
}

type Config added in v0.6.4

type Config struct {
	Backend  string            `yaml:"backend"`
	Backends map[string]string `yaml:"backends"`
	Aliases  map[string]string `yaml:"aliases"`
	Path     string            `yaml:"-"` // omit this little guy
	// contains filtered or unexported fields
}
var Cfg *Config

func (*Config) AddBackend added in v0.6.4

func (cfg *Config) AddBackend(be string, alias string) error

func (*Config) BackendToken added in v0.6.4

func (cfg *Config) BackendToken() string

func (*Config) BackendURI added in v0.6.4

func (cfg *Config) BackendURI() string

func (*Config) ResolveAlias added in v0.6.4

func (cfg *Config) ResolveAlias(be string) string

func (*Config) Save added in v0.6.4

func (cfg *Config) Save() error

func (*Config) SecureBackendURI added in v0.6.4

func (cfg *Config) SecureBackendURI() (string, error)

Hits the /v1/ping endpoint to trigger any HTTP -> HTTPS redirection and then returns the ultimate URL base (minus the '/v1/ping')

func (*Config) UpdateBackend added in v0.6.4

func (cfg *Config) UpdateBackend(be string, token string) error

func (*Config) UpdateCurrentBackend added in v0.6.4

func (cfg *Config) UpdateCurrentBackend(token string) error

func (*Config) UseBackend added in v0.6.4

func (cfg *Config) UseBackend(be string) error

type Job

type Job struct {
	UUID           string `json:"uuid"`
	Name           string `json:"name"`
	Summary        string `json:"summary"`
	RetentionName  string `json:"retention_name"`
	RetentionUUID  string `json:"retention_uuid"`
	Expiry         int    `json:"expiry"`
	ScheduleName   string `json:"schedule_name"`
	ScheduleUUID   string `json:"schedule_uuid"`
	ScheduleWhen   string `json:"schedule_when"`
	Paused         bool   `json:"paused"`
	StoreUUID      string `json:"store_uuid"`
	StoreName      string `json:"store_name"`
	StorePlugin    string `json:"store_plugin"`
	StoreEndpoint  string `json:"store_endpoint"`
	TargetUUID     string `json:"target_uuid"`
	TargetName     string `json:"target_name"`
	TargetPlugin   string `json:"target_plugin"`
	TargetEndpoint string `json:"target_endpoint"`
	Agent          string `json:"agent"`
}

func CreateJob

func CreateJob(contentJSON string) (Job, error)

func GetJob

func GetJob(id uuid.UUID) (Job, error)

func GetJobs

func GetJobs(filter JobFilter) ([]Job, error)

func UpdateJob

func UpdateJob(id uuid.UUID, contentJSON string) (Job, error)

type JobFilter

type JobFilter struct {
	Name      string
	Target    string
	Store     string
	Schedule  string
	Retention string
	Paused    YesNo
}

type RetentionPolicy

type RetentionPolicy struct {
	UUID    string `json:"uuid"`
	Name    string `json:"name"`
	Summary string `json:"summary"`
	Expires uint   `json:"expires"`
}

func CreateRetentionPolicy

func CreateRetentionPolicy(contentJSON string) (RetentionPolicy, error)

func GetRetentionPolicies

func GetRetentionPolicies(filter RetentionPolicyFilter) ([]RetentionPolicy, error)

func GetRetentionPolicy

func GetRetentionPolicy(id uuid.UUID) (RetentionPolicy, error)

func UpdateRetentionPolicy

func UpdateRetentionPolicy(id uuid.UUID, contentJSON string) (RetentionPolicy, error)

type RetentionPolicyFilter added in v0.4.1

type RetentionPolicyFilter struct {
	Unused YesNo
	Name   string
}

type Schedule

type Schedule struct {
	UUID    string `json:"uuid"`
	Name    string `json:"name"`
	Summary string `json:"summary"`
	When    string `json:"when"`
}

func CreateSchedule

func CreateSchedule(contentJSON string) (Schedule, error)

func GetSchedule

func GetSchedule(id uuid.UUID) (Schedule, error)

func GetSchedules

func GetSchedules(filter ScheduleFilter) ([]Schedule, error)

func UpdateSchedule

func UpdateSchedule(id uuid.UUID, contentJSON string) (Schedule, error)

type ScheduleFilter

type ScheduleFilter struct {
	Unused YesNo
	Name   string
}

type Status added in v0.4.1

type Status struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

func GetStatus added in v0.4.1

func GetStatus() (Status, error)

type Store

type Store struct {
	UUID     string `json:"uuid"`
	Name     string `json:"name"`
	Summary  string `json:"summary"`
	Plugin   string `json:"plugin"`
	Endpoint string `json:"endpoint"`
}

func CreateStore

func CreateStore(contentJSON string) (Store, error)

func GetStore

func GetStore(id uuid.UUID) (Store, error)

func GetStores

func GetStores(filter StoreFilter) ([]Store, error)

func UpdateStore

func UpdateStore(id uuid.UUID, contentJSON string) (Store, error)

type StoreFilter

type StoreFilter struct {
	Name       string
	Plugin     string
	Unused     YesNo
	ExactMatch YesNo
}

type Target

type Target struct {
	UUID     string `json:"uuid"`
	Name     string `json:"name"`
	Summary  string `json:"summary"`
	Plugin   string `json:"plugin"`
	Endpoint string `json:"endpoint"`
	Agent    string `json:"agent"`
}

func CreateTarget

func CreateTarget(contentJSON string) (Target, error)

func GetTarget

func GetTarget(id uuid.UUID) (Target, error)

func GetTargets

func GetTargets(filter TargetFilter) ([]Target, error)

func UpdateTarget

func UpdateTarget(id uuid.UUID, contentJSON string) (Target, error)

type TargetFilter

type TargetFilter struct {
	Name   string
	Plugin string
	Unused YesNo
}

type Task

type Task struct {
	UUID        string    `json:"uuid"`
	Owner       string    `json:"owner"`
	Op          string    `json:"type"`
	JobUUID     string    `json:"job_uuid"`
	ArchiveUUID string    `json:"archive_uuid"`
	Status      string    `json:"status"`
	StartedAt   Timestamp `json:"started_at"`
	StoppedAt   Timestamp `json:"stopped_at"`
	TimeoutAt   Timestamp `json:"timeout_at"`
	Log         string    `json:"log"`
}

func GetTask

func GetTask(id uuid.UUID) (Task, error)

func GetTasks

func GetTasks(filter TaskFilter) ([]Task, error)

type TaskFilter

type TaskFilter struct {
	Status string
	Debug  YesNo
	Limit  string
}

type URL

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

func ParseURL

func ParseURL(s string) (*URL, error)

func ShieldURI

func ShieldURI(p string, args ...interface{}) *URL

func (*URL) AddParameter

func (u *URL) AddParameter(key string, value interface{}) error

func (*URL) Delete

func (u *URL) Delete(out interface{}) error

func (*URL) Get

func (u *URL) Get(out interface{}) error

func (*URL) MaybeAddParameter

func (u *URL) MaybeAddParameter(key string, value interface{}) error

func (*URL) Post

func (u *URL) Post(out interface{}, data string) error

func (*URL) Put

func (u *URL) Put(out interface{}, data string) error

func (*URL) Request

func (u *URL) Request(out interface{}, req *http.Request) error

func (*URL) String

func (u *URL) String() string

type YesNo

type YesNo struct {
	On  bool
	Yes bool
}

func Maybe

func Maybe(tf bool) YesNo

func MaybeBools

func MaybeBools(yes bool, no bool) YesNo

func MaybeString

func MaybeString(tf string) YesNo

func No

func No() YesNo

func Yes

func Yes() YesNo

func (*YesNo) Given

func (yn *YesNo) Given() bool

Jump to

Keyboard shortcuts

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