api

package
v0.0.0-...-71b5e92 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIVersion is the version of this Cli
	APIVersion = "v0.1"

	// APIBase is the base url that Cli requests goto
	APIBase = "https://deferpanic.com/" + APIVersion
)

Functions

func GreenBold

func GreenBold(str string) string

func RedBold

func RedBold(str string) string

Types

type Addon

type Addon struct {
	ID          int
	Name        string
	Addon       string
	BuildStatus string
	CreatedAt   string
}

type AddonAvailable

type AddonAvailable struct {
	ID          int
	Name        string
	Description string
}

type Addons

type Addons struct{}

func (*Addons) Available

func (addons *Addons) Available()

Available lists the addons available for the user to provision

func (*Addons) Delete

func (addons *Addons) Delete()

func (*Addons) List

func (addons *Addons) List()

List lists the addons provisioned to the user

func (*Addons) New

func (addons *Addons) New()

type AddonsAvailableResponse

type AddonsAvailableResponse struct {
	Title           string
	Error           string
	AddonsAvailable []AddonAvailable
}

type AddonsResponse

type AddonsResponse struct {
	Title  string
	Error  string
	Addons []Addon
}

type Backups

type Backups struct{}

func (*Backups) List

func (backups *Backups) List()

func (*Backups) Restore

func (backups *Backups) Restore(name string, domain string)

func (*Backups) Save

func (backups *Backups) Save(name string, domain string)

type CliImplementation

type CliImplementation struct {
	Token string
}

CliImplementation is the base struct for making requests to the deferpanic api

func NewCliImplementation

func NewCliImplementation(token string) *CliImplementation

NewCliImplementation instantiates and returns a new deferpanic API cli

func (*CliImplementation) GetJSON

func (c *CliImplementation) GetJSON(url string, iface interface{}) (err error)

GetJSON does a get request and returns json

func (*CliImplementation) GrabFile

func (c *CliImplementation) GrabFile(b []byte, url string, fname string) (err error)

GrabFile downloads to location TODO - refactor me

func (*CliImplementation) GrabRedirectFile

func (c *CliImplementation) GrabRedirectFile(url string, fname string) (err error)

func (*CliImplementation) PostJSON

func (c *CliImplementation) PostJSON(b []byte, url string, iface interface{}) (err error)

PostJSON does a POST request and returns JSON

func (*CliImplementation) Postit

func (c *CliImplementation) Postit(b []byte, url string) (result string, err error)

Postit posts an api request w/b body to url and sets appropriate headers

type CliInterface

type CliInterface interface {
	Postit(b []byte, url string) (result string, err error)
}

CliInterface is the interface for making requests to the deferpanic api

type Compiler

type Compiler struct {
	Name string
}

type Compilers

type Compilers struct{}

func (*Compilers) List

func (compilers *Compilers) List()

type CompilersResponse

type CompilersResponse struct {
	Title     string
	Error     string
	Compilers []Compiler
}

type Dns

type Dns struct{}

type IP

type IP struct {
	ID         int
	IP         string
	Network    string
	Mask       string
	Gateway    string
	Attached   bool
	InstanceID int
}

type IPResponse

type IPResponse struct {
	Title string
	Error string
	IPs   []IP
}

type Image

type Image struct {
	Name          string `json:"Name"`
	Source        string `json:"Source"`
	Addon         string `json:"Addon"`
	Script        string `json:"Script"`
	Compiler      string `json:"Compiler"`
	Language      string `json:"Language"`
	Count         int    `json:"Count"`
	Force         bool   `json:"Force"`
	MakeBin       bool   `json:"MakeBin"`
	SystemVolumes bool   `json:"SystemVolumes"`
	Buildable     bool   `json:"Buildable"`
	Filename      string `json:"Filename"`
}

Image is the base struct for management of images

type Instance

type Instance struct {
	ID        int
	Domain    string
	NetworkID int
	Memory    int
	Disk      int64
	Status    string
	Running   bool
	StartedAt time.Time
}

type Instances

type Instances struct{}

func (*Instances) List

func (instances *Instances) List(name string)

List returns the set of running instances for project name if name is empty it returns all running instances for user

func (*Instances) Log

func (instances *Instances) Log(domain string)

func (*Instances) New

func (instances *Instances) New(name string)

func (*Instances) Pause

func (instances *Instances) Pause(domain string)

func (*Instances) Resume

func (instances *Instances) Resume(domain string)

func (*Instances) ScaleDown

func (instances *Instances) ScaleDown(name string, domain string)

FIXME - wrong api

func (*Instances) ScaleUp

func (instances *Instances) ScaleUp(name string)

FIXME - wrong api

type InstancesResponse

type InstancesResponse struct {
	Title     string
	Error     string
	Instances []Instance
}

type Ips

type Ips struct{}

func (*Ips) Attach

func (ips *Ips) Attach(ipv4 string, domain string)

Attach attaches an ip to an instance

func (*Ips) Detach

func (ips *Ips) Detach(ipv4 string)

Detach detaches an ip to an instance

func (*Ips) List

func (ips *Ips) List()

List returns the set of IPs in user's pool

func (*Ips) Release

func (ips *Ips) Release(ipv4 string)

Release releases an ip from a user's pool

func (*Ips) Request

func (ips *Ips) Request()

Request requests for an ip to be added to a user's pool

type Language

type Language struct {
	ID       int
	Name     string
	Version  string
	Compiler string
}

type Languages

type Languages struct{}

func (*Languages) List

func (languages *Languages) List()

type LanguagesResponse

type LanguagesResponse struct {
	Title     string
	Error     string
	Languages []Language
}

type Manifest

type Manifest struct {
	Processes []ManifestProcess
}

func LoadManifest

func LoadManifest(name string) (Manifest, error)

Temporary stuff for `virgo` refactoring only

type ManifestProcess

type ManifestProcess struct {
	Memory    int
	Kernel    string
	Multiboot bool
	Hash      string
	Cmdline   string
	Env       string
	Volumes   []ManifestVolume
}

type ManifestVolume

type ManifestVolume struct {
	Id    int
	File  string
	Mount string
}

type Networks

type Networks struct{}

type OldInstance

type OldInstance struct {
	Name   string `json:"Name"`
	Domain string `json:"Domain"`
	Force  bool   `json:"Force"`
}

DEPRECATED OldInstance is the base struct for management of instances

type OldVolume

type OldVolume struct {
	Id         int    `json:"ID"`
	Name       string `json:"Name"`
	Owner      string `json:"Owner"`
	Domain     string `json:"Domain"`
	MountPoint string `json:"MountPoint"`
	Filename   string `json:"Filename"`
}

OldVolume is the base struct for management of volumes DEPRECATED

type Project

type Project struct {
	ID          int
	Name        string
	Buildable   string
	Language    string
	Source      string
	BuildStatus string
	Filename    string
	Addon       string
	CreatedAt   time.Time
}

type ProjectLogResponse

type ProjectLogResponse struct {
	Error string
	Body  string
}

type Projects

type Projects struct{}

func (*Projects) Delete

func (projects *Projects) Delete(name string)

Delete deletes a project

func (*Projects) Download

func (projects *Projects) Download(name string, path string) error

Download a project root image

func (*Projects) DownloadCommunity

func (projects *Projects) DownloadCommunity(name string, user string, path string) error

DownloadCommunity downloads a community kernel by project name and user name the project that holds this kernel must be public

func (*Projects) List

func (projects *Projects) List()

List lists all your projects

func (*Projects) Log

func (projects *Projects) Log(name string)

Log shows the latest build log for your project by name

func (*Projects) Manifest

func (projects *Projects) Manifest(name string) error

Manifest is a json representation for your project useful for running things locally

func (*Projects) New

func (projects *Projects) New(name string, language string, compiler string, source string, script string)

New creates a new project

func (*Projects) NewFromImage

func (projects *Projects) NewFromImage(name string, imagePath string)

NewFromImage creates a new project from an image

func (*Projects) Upload

func (projects *Projects) Upload(name string, binary string)

Upload uploads a project

type ProjectsResponse

type ProjectsResponse struct {
	Title    string
	Error    string
	Projects []Project
}

type Resource

type Resource struct {
	Name    string `json:"Name"`
	Owner   string `json:"Owner"`
	Builtin string `json:"Builtin"`
}

Resource is the base struct for management of resources

type Resources

type Resources struct{}

func (*Resources) Available

func (resources *Resources) Available()

Available lists the resources available

func (*Resources) List

func (resources *Resources) List()

List lists the resources provisioned

func (*Resources) ListByName

func (resources *Resources) ListByName(name string)

ListByName lists the resources provisioned to project_name

func (*Resources) New

func (resources *Resources) New(name string, owner string, builtin string)

New provisions and attaches a resource to a project

type Search struct{}

func (*Search) Find

func (search *Search) Find(description string)

Find lists public projects w/a name or a description that match description

func (*Search) FindWithStars

func (search *Search) FindWithStars(description string, starcnt int)

Find lists public projects w/a name or a description that match description && have at least star cnt

func (*Search) Format

func (search *Search) Format(sr SearchResponse)

type SearchItem

type SearchItem struct {
	Name        string
	Description string
	Stars       int
	Language    string
	Source      string
	CreatedAt   time.Time
}

type SearchResponse

type SearchResponse struct {
	Title       string
	Error       string
	SearchItems []SearchItem
}

type Status

type Status struct{}

func (*Status) Show

func (status *Status) Show()

type Tls

type Tls struct{}

type Usage

type Usage struct{}

type User

type User struct {
	Email    string
	Username string
	Password string
}

type Users

type Users struct{}

func (*Users) Create

func (users *Users) Create(email string, username string, password string)

Create creates a new user and returns the token

type UsersResponse

type UsersResponse struct {
	Token string
	Error string
}

type Volume

type Volume struct {
	ID         int
	Name       string
	MountPoint string
	Filename   string
	ProjectId  int
	Size       string
	InstanceId int
	Orphaned   bool
	Attached   bool
	Mutable    bool
	FileSystem string
	System     bool
	CreatedAt  string
}

type Volumes

type Volumes struct{}

func (*Volumes) Attach

func (volumes *Volumes) Attach(name string, domain string)

Attach attaches a volume from a project

func (*Volumes) Detach

func (volumes *Volumes) Detach(name string, domain string)

Detach detaches a volume from a project

func (*Volumes) Download

func (volumes *Volumes) Download(id int, dst string) error

Downloads a volume by id FIXME

func (*Volumes) List

func (volumes *Volumes) List(volume *OldVolume)

List lists volumes

func (*Volumes) ListByDomain

func (volumes *Volumes) ListByDomain(domain string)

ListByDomain lists volumes attached to a given domain

func (*Volumes) ListByName

func (volumes *Volumes) ListByName(name string)

ListByName lists volumes that are within a project by name

type VolumesResponse

type VolumesResponse struct {
	Title   string
	Error   string
	Volumes []Volume
}

Jump to

Keyboard shortcuts

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