jiffybox

package
v0.0.0-...-e104627 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_START    = "START"
	STATUS_SHUTDOWN = "SHUTDOWN"
	STATUS_PULLPLUG = "PULLPLUG"
	STATUS_FREEZE   = "FREEZE"
	STATUS_THAW     = "THAW"
)
View Source
const ENV_API_TOKEN = "JIFFYBOX_API_KEY"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveProfile

type ActiveProfile struct {
	Name         string           `json:"name"`         // "Standard",
	Created      int              `json:"created"`      // 1234567890,
	Runlevel     string           `json:"runlevel"`     // "default",
	Kernel       string           `json:"kernel"`       // "xen-current",
	Rootdisk     string           `json:"rootdisk"`     // "\/dev\/xvda",
	RootdiskMode string           `json:"rootdiskMode"` // "ro",
	Status       string           `json:"status"`       // "READY",
	DisksHash    map[string]*Disk `json:"disks"`
}

func (*ActiveProfile) Disks

func (ap *ActiveProfile) Disks() (disks []*Disk)

type Backup

type Backup struct {
	ServerId int
	Key      string
	Id       string `json:"id"`
	Created  int64  `json:"created"`
}

func (*Backup) CreatedAt

func (backup *Backup) CreatedAt() time.Time

type BackupsForServerResponse

type BackupsForServerResponse struct {
	Message []*Message         `json:"message"`
	Result  map[string]*Backup `json:"result"`
}

type BackupsResponse

type BackupsResponse struct {
	Message []*Message                    `json:"message"`
	Result  map[string]map[string]*Backup `json:"result"`
}

type Client

type Client struct {
	ApiKey string
}

func NewFromEnv

func NewFromEnv() *Client

func (*Client) Backups

func (client *Client) Backups() (backups []*Backup, e error)

func (*Client) BackupsForServer

func (client *Client) BackupsForServer(id int) (backups []*Backup, e error)

func (*Client) BaseUrl

func (client *Client) BaseUrl() string

func (*Client) ChangeState

func (client *Client) ChangeState(id int, state string, planId int) (server *Server, e error)

func (*Client) ChangeStatus

func (client *Client) ChangeStatus(id string, status string, planId int, metadata string) (server *Server, e error)

func (*Client) CloneServer

func (client *Client) CloneServer(id int, opts *CreateOptions) (server *Server, e error)

func (*Client) CreateBackup

func (client *Client) CreateBackup(id int) error

func (*Client) CreateJiffyBox

func (client *Client) CreateJiffyBox(options *CreateOptions) (server *Server, e error)

func (*Client) DeleteJiffyBox

func (client *Client) DeleteJiffyBox(id int) (e error)

func (*Client) Distribution

func (client *Client) Distribution(id string) (dist *Distribution, e error)

func (*Client) Distributions

func (client *Client) Distributions() (dists []*Distribution, e error)

func (*Client) FreezeServer

func (client *Client) FreezeServer(id int) (server *Server, e error)

func (*Client) JiffyBox

func (client *Client) JiffyBox(id int) (server *Server, e error)

func (*Client) JiffyBoxes

func (client *Client) JiffyBoxes() (servers []*Server, e error)

func (*Client) LoadResource

func (client *Client) LoadResource(action string, i interface{}) error

func (*Client) Plan

func (client *Client) Plan(id string) (plan *Plan, e error)

func (*Client) Plans

func (client *Client) Plans() (plans []*Plan, e error)

func (*Client) PostForm

func (client *Client) PostForm(action string, values url.Values) (rsp *HttpResponse, e error)

func (*Client) PullPlugServer

func (client *Client) PullPlugServer(id int) (server *Server, e error)

func (*Client) ShutdownServer

func (client *Client) ShutdownServer(id int) (server *Server, e error)

func (*Client) StartServer

func (client *Client) StartServer(id int, planId int) (server *Server, e error)

func (*Client) ThawServer

func (client *Client) ThawServer(id int, planId int) (server *Server, e error)

unfreeze server

func (*Client) Validate

func (client *Client) Validate() error

type CreateOptions

type CreateOptions struct {
	Name         string
	PlanId       int
	BackupId     string
	Distribution string
	Password     string
	UseSshKey    bool
	Metadata     string
}

type Disk

type Disk struct {
	Name       string `json:"name"`       //" Swap",
	Filesystem string `json:"filesystem"` // "swap",
	SizeInMB   int    `json:"sizeInMB"`   // 512,
	Created    int    `json:"created"`    // 1234567890,
	Status     string `json:"status"`     // "READY"
}

type Distribution

type Distribution struct {
	Key           string
	MinDiskSizeMB int    `json:"minDiskSizeMB"`
	Name          string `json:"name"`
	RootdiskMode  string `json:"rootdiskMode"`
	DefaultKernel string `json:"defaultKernel"`
}

type DistributionResponse

type DistributionResponse struct {
	Distribution *Distribution `json:"result"`
}

type DistributionsResponse

type DistributionsResponse struct {
	DistributionsMap map[string]*Distribution `json:"result"`
}

func (*DistributionsResponse) Distributions

func (rsp *DistributionsResponse) Distributions() (distributions []*Distribution)

type ErrorResponse

type ErrorResponse struct {
	Messages []*Message `json:"messages"`
	Result   bool       `json:"result"`
}

type HttpResponse

type HttpResponse struct {
	StatusCode int
	Content    []byte
	Response   *http.Response
}

type JiffyBoxResponse

type JiffyBoxResponse struct {
	Messages []*Message
	Server   *Server `json:"result"`
}

type JiffyBoxesResponse

type JiffyBoxesResponse struct {
	Messages   []*Message         `json:"messages:"`
	ServersMap map[string]*Server `json:"result"`
}

func (*JiffyBoxesResponse) Server

func (rsp *JiffyBoxesResponse) Server() *Server

func (*JiffyBoxesResponse) Servers

func (rsp *JiffyBoxesResponse) Servers() []*Server

type Message

type Message struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

type Plan

type Plan struct {
	Id                 int     `json:"id"`                 //22,
	Name               string  `json:"name"`               //"CloudLevel 3",
	DiskSizeInMB       int     `json:"diskSizeInMB"`       //307200,
	RamInMB            int     `json:"ramInMB"`            //8192,
	PricePerHour       float64 `json:"pricePerHour"`       //0.07,
	PricePerHourFrozen float64 `json:"pricePerHourFrozen"` //0.02,
	Cpus               int     `json:"cpus"`               //6
}

type PlanResponse

type PlanResponse struct {
	Messages []string `json:"messages"`
	Plan     *Plan    `json:"result"`
}

type PlansResponse

type PlansResponse struct {
	Messages []string         `json:"messages"`
	PlansMap map[string]*Plan `json:"result"`
}

func (*PlansResponse) Plans

func (rsp *PlansResponse) Plans() (plans []*Plan)

type Response

type Response struct {
	Messages []string `json:"messages"`
	Result   bool     `json:"result"`
}

type Server

type Server struct {
	Id                  int                 `json:"id"`
	Name                string              `json:"name"`
	Ips                 map[string][]string `json:"ips"`
	Status              string              `json:"status"`
	Created             int64               `json:"created"`
	RecoverymodeActive  bool                `json:"recoverymodeActive"`
	ManualBackupRunning bool                `json:"manualBackupRunning"`
	IsBeingCopied       bool                `json:"isBeingCopied"`
	Running             bool                `json:"running"`
	Host                string              `json:"host"`
	Plan                *Plan               `json:"plan"`
	ActiveProfile       *ActiveProfile      `json:"activeProfile"`
	Metadata            map[string]string   `json:"metadata"`
}

func (*Server) CreatedAt

func (server *Server) CreatedAt() time.Time

func (*Server) Frozen

func (server *Server) Frozen() bool

func (*Server) IpsString

func (server *Server) IpsString() string

func (*Server) PublicIp

func (server *Server) PublicIp() string

Jump to

Keyboard shortcuts

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