api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIUrl represents Online's endpoint
	APIUrl = "https://api.online.net/api/v1"
)

Functions

func CleanUp

func CleanUp() (c *cache)

func NewCache

func NewCache() (c *cache)

Types

type ConfigCreateArchive

type ConfigCreateArchive struct {
	UUIDSafe    string
	Name        string
	Desc        string
	Parity      string
	Protocols   []string
	SSHKeys     []string
	Platforms   []string
	Days        int
	LargeBucket bool
	Crypto      string
}

type ConfigCreateSSHBucketFromScratch

type ConfigCreateSSHBucketFromScratch struct {
	SafeName    string
	ArchiveName string
	Desc        string
	UUIDSSHKeys []string
	Platforms   []string
	Days        int
	Quiet       bool
	Parity      string
	LargeBucket bool
	Crypto      string
}

type OnlineAPI

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

OnlineAPI is used to communicate with Online API

func NewC14API

func NewC14API(client *http.Client, userAgent string, verbose bool) (api *OnlineAPI)

NewC14API returns a new API

func (*OnlineAPI) CleanUpCache

func (o *OnlineAPI) CleanUpCache()

func (*OnlineAPI) CreateArchive

func (o *OnlineAPI) CreateArchive(config ConfigCreateArchive) (uuid string, err error)

func (*OnlineAPI) CreateSSHBucketFromScratch

func (o *OnlineAPI) CreateSSHBucketFromScratch(c ConfigCreateSSHBucketFromScratch) (uuidSafe, uuidArchive string, bucket OnlineGetBucket, err error)

CreateSSHBucketFromScratch creates a safe, an archive and returns the bucket available over SSH

func (*OnlineAPI) CreateSafe

func (o *OnlineAPI) CreateSafe(name, desc string) (uuid string, err error)

func (*OnlineAPI) DeleteArchive

func (o *OnlineAPI) DeleteArchive(uuidSafe, uuidArchive string) (err error)

func (*OnlineAPI) DeleteSafe

func (o *OnlineAPI) DeleteSafe(uuid string) (err error)

func (*OnlineAPI) FetchRessources

func (o *OnlineAPI) FetchRessources() (err error)

FetchRessources get the ressources to fill the cache

func (*OnlineAPI) FindSafeUUIDFromArchive

func (o *OnlineAPI) FindSafeUUIDFromArchive(archive string, useCache bool) (safe OnlineGetSafe, uuidArchive string, err error)

func (*OnlineAPI) GetAllArchives

func (o *OnlineAPI) GetAllArchives() (archives []OnlineGetArchive, err error)

func (*OnlineAPI) GetArchive

func (o *OnlineAPI) GetArchive(uuidSafe, uuidArchive string, useCache bool) (archive OnlineGetArchive, err error)

func (*OnlineAPI) GetArchives

func (o *OnlineAPI) GetArchives(uuidSafe string, useCache bool) (archives []OnlineGetArchive, err error)

func (*OnlineAPI) GetBucket

func (o *OnlineAPI) GetBucket(uuidSafe, uuidArchive string) (bucket OnlineGetBucket, err error)

func (*OnlineAPI) GetJob

func (o *OnlineAPI) GetJob(uuidSafe, uuidArchive, uuidJob string) (job OnlineGetJob, err error)

func (*OnlineAPI) GetJobs

func (o *OnlineAPI) GetJobs(uuidSafe, uuidArchive string) (jobs []OnlineGetJob, err error)

func (*OnlineAPI) GetLocations

func (o *OnlineAPI) GetLocations(uuidSafe, uuidArchive string) (loc []OnlineGetLocation, err error)

func (*OnlineAPI) GetPlatform

func (o *OnlineAPI) GetPlatform(uuid string) (platform OnlineGetPlatform, err error)

GetPlatform returns a platform

func (*OnlineAPI) GetPlatforms

func (o *OnlineAPI) GetPlatforms() (platform []OnlineGetPlatform, err error)

GetPlatforms returns a list of platform

func (*OnlineAPI) GetSSHKey

func (o *OnlineAPI) GetSSHKey(uuid string) (key OnlineGetSSHKey, err error)

func (*OnlineAPI) GetSSHKeys

func (o *OnlineAPI) GetSSHKeys() (keys []OnlineGetSSHKey, err error)

func (*OnlineAPI) GetSafe

func (o *OnlineAPI) GetSafe(uuid string) (safe OnlineGetSafe, err error)

GetSafe returns a safe

func (*OnlineAPI) GetSafes

func (o *OnlineAPI) GetSafes(useCache bool) (safes []OnlineGetSafe, err error)

GetSafes returns a list of safe

func (*OnlineAPI) PatchArchive

func (o *OnlineAPI) PatchArchive(uuidSafe, uuidArchive string, data OnlinePatchArchive) (err error)

func (*OnlineAPI) PostArchive

func (o *OnlineAPI) PostArchive(uuidSafe, uuidArchive string) (uuid string, err error)

func (*OnlineAPI) PostUnArchive

func (o *OnlineAPI) PostUnArchive(uuidSafe, uuidArchive string, data OnlinePostUnArchive) (err error)

func (*OnlineAPI) PostVerify

func (o *OnlineAPI) PostVerify(uuidSafe, uuidArchive, uuidLocation string) (err error)

type OnlineBucketCredentials

type OnlineBucketCredentials struct {
	Login    string            `json:"login"`
	Password string            `json:"password"`
	Protocol string            `json:"protocol"`
	SSHKeys  []OnlineGetSSHKey `json:"ssh_keys"`
	URI      string            `json:"uri"`
}

type OnlineError

type OnlineError struct {
	Why        string `json:"error"`
	Code       int    `json:"code"`
	StatusCode int    `json:"-"`
}

OnlineError represents the structure returned by the Online API when an error occurred

func (OnlineError) Error

func (o OnlineError) Error() string

type OnlineGetArchive

type OnlineGetArchive struct {
	// _ref         string `json:"$ref"`
	CreationDate string         `json:"creation_date"`
	Description  string         `json:"description"`
	Name         string         `json:"name"`
	Parity       string         `json:"parity"`
	Status       string         `json:"status"`
	UUIDRef      string         `json:"uuid_ref"`
	Size         string         `json:"size"`
	Jobs         []OnlineGetJob `json:"current_jobs,omitempty"`
	Safe         OnlineGetSafe  `json:"safe"`
}

type OnlineGetArchives

type OnlineGetArchives []OnlineGetArchive

func (OnlineGetArchives) Len

func (o OnlineGetArchives) Len() int

func (OnlineGetArchives) Less

func (o OnlineGetArchives) Less(i, j int) bool

func (OnlineGetArchives) Swap

func (o OnlineGetArchives) Swap(i, j int)

type OnlineGetBucket

type OnlineGetBucket struct {
	// _ref         string `json:"$ref"`
	ArchivalDate string                    `json:"archival_date"`
	Credentials  []OnlineBucketCredentials `json:"credentials"`
	Status       string                    `json:"status"`
	UUIDRef      string                    `json:"uuid_ref"`
}

type OnlineGetJob

type OnlineGetJob struct {
	// _ref     string `json:"$ref"`
	Progress int    `json:"progress"`
	Status   string `json:"status"`
	Type     string `json:"type"`
	UUIDRef  string `json:"uuid_ref"`
}

type OnlineGetLocation

type OnlineGetLocation struct {
	// _ref         string `json:"$ref"`
	UUIDRef string `json:"uuid_ref"`
	Name    string `json:"name"`
}

type OnlineGetPlatform

type OnlineGetPlatform struct {
	// _ref       string `json:"$ref"`
	Datacenter string `json:"datacenter"`
	ID         int    `json:"id"`
	Name       string `json:"name"`
}

OnlineGetPlatform represents the reponse of a GET /platform/UUID

type OnlineGetSSHKey

type OnlineGetSSHKey struct {
	// _ref string `json:"$ref"`
	Desc        string `json:"description"`
	Fingerprint string `json:"fingerprint"`
	UUIDRef     string `json:"uuid_ref"`
}

type OnlineGetSafe

type OnlineGetSafe struct {
	// _ref         string `json:"$ref"`
	Description string `json:"description"`
	Name        string `json:"name"`
	Status      string `json:"status"`
	UUIDRef     string `json:"uuid_ref"`
}

OnlineGetSafe represents the response of a GET /safe/UUID

type OnlinePatchArchive

type OnlinePatchArchive struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type OnlinePostArchive

type OnlinePostArchive struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Parity      string   `json:"parity,omitempty"`
	Protocols   []string `json:"protocols"`
	SSHKeys     []string `json:"ssh_keys"`
	Platforms   []string `json:"platforms"`
	Days        int      `json:"days"`
	LargeBucket bool     `json:"large_bucket"`
	Crypto      string   `json:"crypto"`
}

type OnlinePostResult

type OnlinePostResult struct {
	UUIDRef string `json:"uuid_ref"`
	Archive *struct {
		UUIDRef string `json:"uuid_ref"`
		Name    string `json:"name"`
		Status  string `json:"status"`
	} `json:"archive"`
}

type OnlinePostSafe

type OnlinePostSafe struct {
	Description string `json:"description"`
	Name        string `json:"name"`
}

type OnlinePostUnArchive

type OnlinePostUnArchive struct {
	Protocols  []string `json:"protocols"`
	SSHKeys    []string `json:"ssh_keys"`
	LocationID string   `json:"location_id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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