scalingo

package
v0.1.5-0...-5436c12 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2015 License: BSD-4-Clause Imports: 16 Imported by: 4

README

Go client for Scalingo API

Documentation

Index

Constants

View Source
const (
	EnvNameMaxLength  = 64
	EnvValueMaxLength = 1024
)

Variables

View Source
var (
	ErrLoginAborted  = errors.New("canceled by user.")
	ApiAuthenticator Authenticator
	ApiUrl           string
	ApiVersion       string
)
View Source
var CurrentUser *users.User

Functions

func AddonDestroy

func AddonDestroy(app, addonID string) error

func AppsDestroy

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

func AppsRestart

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

func AppsScale

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 AuthFromConfig

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

func AuthUser

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

func CollaboratorRemove

func CollaboratorRemove(app string, id string) error

func DomainsRemove

func DomainsRemove(app string, id string) error

func IsRequestFailedError

func IsRequestFailedError(err error) bool

func KeysDelete

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

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

func ParseJSON

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

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

func SignUp

func SignUp(email, password string) error

func VariableUnset

func VariableUnset(app string, id string) error

Types

type APIRequest

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

func (*APIRequest) BuildQueryFromParams

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

func (*APIRequest) Do

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

Execute an API request and return its response/error

func (*APIRequest) FillDefaultValues

func (req *APIRequest) FillDefaultValues() error

type Addon

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

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

type AddonProvider

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

func AddonProvidersList

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

type AddonRes

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

func AddonProvision

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

func AddonUpgrade

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

type AddonsRes

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

type App

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

func (app App) String() string

type AppsPsRes

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

type AppsRestartParams

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

type AppsScaleParams

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

type Authenticator

type Authenticator interface {
	LoadAuth() (*users.User, error)
	StoreAuth(user *users.User) error
	RemoveAuth() error
}

type BadRequestError

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

func (BadRequestError) Error

func (err BadRequestError) Error() string

type Collaborator

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

func CollaboratorAdd

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

func CollaboratorsList

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

type CollaboratorRes

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

type CollaboratorsRes

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

type Container

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

func AppsPs

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

type CreateAppParams

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

type Domain

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

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

func DomainsList

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

func DomainsUpdate

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

type DomainRes

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

type DomainsRes

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

type Key

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

func KeysAdd

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

func KeysList

func KeysList() ([]Key, error)

type KeyIndex

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

type ListParams

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

type LoginError

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

func (*LoginError) Error

func (err *LoginError) Error() string

type LoginResponse

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

type NotFoundError

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

func (NotFoundError) Error

func (err NotFoundError) Error() string

type Operation

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

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

func (*Operation) ElapsedDuration

func (op *Operation) ElapsedDuration() float64

type OperationResponse

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

type PaymentRequiredError

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

func (PaymentRequiredError) Error

func (err PaymentRequiredError) Error() string

type Plan

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

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

type PlansParams

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

type RequestFailedError

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

func (*RequestFailedError) Error

func (err *RequestFailedError) Error() string

func (*RequestFailedError) String

func (err *RequestFailedError) String() string

type SelfResults

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

type Statuses

type Statuses []int

func (Statuses) Contains

func (statuses Statuses) Contains(status int) bool

type UnprocessableEntity

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

func (UnprocessableEntity) Error

func (err UnprocessableEntity) Error() string

type Variable

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

func VariableSet

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

type VariableSetParams

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

type Variables

type Variables []*Variable

func VariableMultipleSet

func VariableMultipleSet(app string, variables Variables) (Variables, int, error)

func VariablesList

func VariablesList(app string) (Variables, error)

func VariablesListWithoutAlias

func VariablesListWithoutAlias(app string) (Variables, error)

func (Variables) Contains

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

type VariablesRes

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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