api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: BSD-4-Clause, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvNameMaxLength  = 64
	EnvValueMaxLength = 1024
)

Variables

View Source
var CurrentUser *users.User
View Source
var (
	LoginAbortedErr = errors.New("canceled by user.")
)

Functions

func AddonDestroy added in v1.1.0

func AddonDestroy(app, addonID string) error

func AppsDestroy

func AppsDestroy(name string, currentName string) (*http.Response, error)

func AppsRestart added in v1.1.0

func AppsRestart(app string, scope *AppsRestartParams) (*http.Response, error)

func AppsScale added in v1.1.0

func AppsScale(app string, params *AppsScaleParams) (*http.Response, error)

Handling 422 error as not a standard 422 error

{
   "errors": {
      "web": {
         "amount": ["is negative"]
      }
   }
}

func AppsShow

func AppsShow(app string) (*http.Response, error)

func Auth added in v1.1.0

func Auth() (*users.User, error)

func AuthFromConfig added in v1.1.0

func AuthFromConfig() (*users.User, error)

func AuthUser added in v1.1.0

func AuthUser(login, passwd string) (*users.User, error)

func CollaboratorRemove added in v1.1.0

func CollaboratorRemove(app string, id string) error

func DomainsRemove added in v1.1.0

func DomainsRemove(app string, id string) error

func IsRequestFailedError added in v1.1.0

func IsRequestFailedError(err error) bool

func KeysDelete added in v1.1.0

func KeysDelete(id string) error

func Login

func Login(email, password string) (*http.Response, error)

func Logs

func Logs(logsURL string, n int, filter string) (*http.Response, error)

func LogsURL

func LogsURL(app string) (*http.Response, error)

func NewRequestFailedError added in v1.1.0

func NewRequestFailedError(res *http.Response, req *APIRequest) error

func ParseJSON added in v1.1.0

func ParseJSON(res *http.Response, data interface{}) error

func Run

func Run(app string, command []string, env map[string]string) (*http.Response, error)

func Self added in v1.1.0

func Self() (*users.User, error)

func SignUp added in v1.1.0

func SignUp(email, password string) error

func VariableUnset added in v1.1.0

func VariableUnset(app string, id string) error

Types

type APIRequest added in v1.1.0

type APIRequest struct {
	NoAuth      bool
	URL         string
	Method      string
	Endpoint    string
	Token       string
	Expected    Statuses
	Params      interface{}
	HTTPRequest *http.Request
}

func (*APIRequest) BuildQueryFromParams added in v1.1.0

func (req *APIRequest) BuildQueryFromParams() (url.Values, error)

func (*APIRequest) Do added in v1.1.0

func (req *APIRequest) Do() (*http.Response, error)

Execute an API request and return its response/error

func (*APIRequest) FillDefaultValues added in v1.1.0

func (req *APIRequest) FillDefaultValues() error

type Addon added in v1.1.0

type Addon struct {
	ID              string         `json:"id"`
	ResourceID      string         `json:"resource_id"`
	PlanID          string         `json:"plan_id"`
	AddonProviderID string         `json:"addon_provider_id"`
	Plan            *Plan          `json:"plan"`
	AddonProvider   *AddonProvider `json:"addon_provider"`
}

func AddonsList added in v1.1.0

func AddonsList(app string) ([]*Addon, error)

type AddonProvider added in v1.1.0

type AddonProvider struct {
	ID      string `json:"id"`
	LogoURL string `json:"logo_url"`
	Name    string `json:"name"`
}

func AddonProvidersList added in v1.1.0

func AddonProvidersList() ([]*AddonProvider, error)

type AddonRes added in v1.1.0

type AddonRes struct {
	Addon     Addon    `json:"addon"`
	Message   string   `json:"message,omitempty"`
	Variables []string `json:"variables,omitempty"`
}

func AddonProvision added in v1.1.0

func AddonProvision(app, addon, planID string) (AddonRes, error)

func AddonUpgrade added in v1.1.0

func AddonUpgrade(app, addonID, planID string) (AddonRes, error)

type AddonsRes added in v1.1.0

type AddonsRes struct {
	Addons []*Addon `json:"addons"`
}

type App added in v1.1.0

type App struct {
	Id    string `json:"_id"`
	Name  string `json:"name"`
	Owner struct {
		Username string `json:"username"`
		Email    string `json:"email"`
	} `json:"owner"`
	GitUrl    string    `json:"git_url"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"update_at"`
}

func AppsCreate

func AppsCreate(app string) (*App, error)

func AppsList

func AppsList() ([]*App, error)

func (App) String added in v1.1.0

func (app App) String() string

type AppsPsRes added in v1.1.0

type AppsPsRes struct {
	Containers []Container `json:"containers"`
}

type AppsRestartParams added in v1.1.0

type AppsRestartParams struct {
	Scope []string `json:"scope"`
}

type AppsScaleParams added in v1.1.0

type AppsScaleParams struct {
	Containers []Container `json:"containers"`
}

type BadRequestError

type BadRequestError struct {
	ErrMessage string `json:"error"`
}

func (BadRequestError) Error added in v1.1.0

func (err BadRequestError) Error() string

type Collaborator added in v1.1.0

type Collaborator struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email"`
	Status   string `json:"status"`
}

func CollaboratorAdd added in v1.1.0

func CollaboratorAdd(app string, email string) (Collaborator, error)

func CollaboratorsList added in v1.1.0

func CollaboratorsList(app string) ([]Collaborator, error)

type CollaboratorRes added in v1.1.0

type CollaboratorRes struct {
	Collaborator Collaborator `json:"collaborator"`
}

type CollaboratorsRes added in v1.1.0

type CollaboratorsRes struct {
	Collaborators []Collaborator `json:"collaborators"`
}

type Container added in v1.1.0

type Container struct {
	Name    string `json:"name"`
	Amount  int    `json:"amount"`
	Command string `json:"command"`
	Size    string `json:"size"`
}

func AppsPs added in v1.1.0

func AppsPs(app string) ([]Container, error)

type CreateAppParams added in v1.1.0

type CreateAppParams struct {
	App *App `json:"app"`
}

type Domain added in v1.1.0

type Domain struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	TlsCert  string    `json:"tlscert,omitempty"`
	TlsKey   string    `json:"tlskey,omitempty"`
	SSL      bool      `json:"ssl"`
	Validity time.Time `json:"validity"`
}

func DomainsAdd added in v1.1.0

func DomainsAdd(app string, d Domain) (Domain, error)

func DomainsList added in v1.1.0

func DomainsList(app string) ([]Domain, error)

func DomainsUpdate added in v1.1.0

func DomainsUpdate(app, id, cert, key string) (Domain, error)

type DomainRes added in v1.1.0

type DomainRes struct {
	Domain Domain `json:"domain"`
}

type DomainsRes added in v1.1.0

type DomainsRes struct {
	Domains []Domain `json:"domains"`
}

type Key added in v1.1.0

type Key struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Content string `json:"content"`
}

func KeysAdd added in v1.1.0

func KeysAdd(name string, content string) (*Key, error)

func KeysList added in v1.1.0

func KeysList() ([]Key, error)

type KeyIndex added in v1.1.0

type KeyIndex struct {
	Keys []Key `json:"keys"`
}

type ListParams added in v1.1.0

type ListParams struct {
	AddonProviders []*AddonProvider `json:"addon_providers"`
}

type LoginError added in v1.1.0

type LoginError struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

func (*LoginError) Error added in v1.1.0

func (err *LoginError) Error() string

type LoginResponse added in v1.1.0

type LoginResponse struct {
	AuthenticationToken string      `json:"authentication_token"`
	User                *users.User `json:"user"`
}

type NotFoundError added in v1.1.0

type NotFoundError struct {
	Resource string `json:"resource"`
	Err      string `json:"error"`
}

func (NotFoundError) Error added in v1.1.0

func (err NotFoundError) Error() string

type Operation added in v1.1.0

type Operation struct {
	ID         string    `json:"id"`
	CreatedAt  time.Time `json:"created_at"`
	FinishedAt time.Time `json:"finished_at"`
	Status     string    `json:"status"`
	Type       string    `json:"type"`
	Error      string    `json:"error"`
}

func OperationsShow added in v1.1.0

func OperationsShow(app string, opID string) (*Operation, error)

func (*Operation) ElapsedDuration added in v1.1.0

func (op *Operation) ElapsedDuration() float64

type OperationResponse added in v1.1.0

type OperationResponse struct {
	Op Operation `json:"operation"`
}

type PaymentRequiredError added in v1.1.0

type PaymentRequiredError struct {
	ErrMessage string `json:"error"`
	URL        string `json:"url"`
}

func (PaymentRequiredError) Error added in v1.1.0

func (err PaymentRequiredError) Error() string

type Plan added in v1.1.0

type Plan struct {
	ID               string `json:"id"`
	LogoURL          string `json:"logo_url"`
	DisplayName      string `json:"display_name"`
	Name             string `json:"name"`
	ShortDescription string `json:"short_description"`
	Description      string `json:"description"`
}

func AddonProviderPlansList added in v1.1.0

func AddonProviderPlansList(addon string) ([]*Plan, error)

type PlansParams added in v1.1.0

type PlansParams struct {
	Plans []*Plan `json:"plans"`
}

type RequestFailedError added in v1.1.0

type RequestFailedError struct {
	Code     int
	APIError error
	Req      *APIRequest
}

func (*RequestFailedError) Error added in v1.1.0

func (err *RequestFailedError) Error() string

func (*RequestFailedError) String added in v1.1.0

func (err *RequestFailedError) String() string

type SelfResults added in v1.1.0

type SelfResults struct {
	User *users.User `json:"user"`
}

type Statuses added in v1.1.0

type Statuses []int

func (Statuses) Contains added in v1.1.0

func (statuses Statuses) Contains(status int) bool

type UnprocessableEntity added in v1.1.0

type UnprocessableEntity struct {
	Errors map[string][]string `json:"errors"`
}

func (UnprocessableEntity) Error added in v1.1.0

func (err UnprocessableEntity) Error() string

type Variable added in v1.1.0

type Variable struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

func VariableSet added in v1.1.0

func VariableSet(app string, name string, value string) (*Variable, int, error)

type VariableSetParams added in v1.1.0

type VariableSetParams struct {
	Variable *Variable `json:"variable"`
}

type Variables added in v1.1.0

type Variables []*Variable

func VariablesList added in v1.1.0

func VariablesList(app string) (Variables, error)

func VariablesListWithoutAlias added in v1.1.0

func VariablesListWithoutAlias(app string) (Variables, error)

func (Variables) Contains added in v1.1.0

func (vs Variables) Contains(name string) (*Variable, bool)

type VariablesRes added in v1.1.0

type VariablesRes struct {
	Variables Variables `json:"variables"`
}

Jump to

Keyboard shortcuts

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