app

package
v0.0.0-...-9451de5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAppNotFound            = errors.New("App not found")
	ErrPlanNotFound           = errors.New("plan not found")
	ErrPlanAlreadyExists      = errors.New("plan already exists")
	ErrPlanDefaultAmbiguous   = errors.New("more than one default plan found")
	ErrPlanDefaultNotFound    = errors.New("default plan not found")
	ErrLimitOfCpuShare        = errors.New("The minimum allowed cpu-shares is 2")
	ErrLimitOfMemory          = errors.New("The minimum allowed memory is 4MB")
	ErrPlatformNameMissing    = errors.New("Platform name is required.")
	ErrPlatformImageMissing   = errors.New("Platform image is required.")
	ErrPlatformNotFound       = errors.New("Platform doesn't exist.")
	ErrDuplicatePlatform      = errors.New("Duplicate platform")
	ErrInvalidPlatform        = errors.New("Invalid platform")
	ErrMissingFileContent     = errors.New("Missing file content.")
	ErrDeletePlatformWithApps = errors.New("Platform has apps. You must remove them before remove the platform.")
	ErrInvalidPlatformName    = &tsuruErrors.ValidationError{
		Message: "Invalid platform name, should have at most 40 " +
			"characters, containing only lower case letters, numbers or dashes, " +
			"starting with a letter.",
	}
)

Functions

This section is empty.

Types

type AppCreationError

type AppCreationError struct {
	App string
	Err error
}

func (*AppCreationError) Error

func (e *AppCreationError) Error() string

type AppLock

type AppLock struct {
	Locked      bool
	Reason      string
	Owner       string
	AcquireDate time.Time
}

AppLock stores information about a lock hold on the app

func (*AppLock) GetAcquireDate

func (l *AppLock) GetAcquireDate() time.Time

func (*AppLock) GetLocked

func (l *AppLock) GetLocked() bool

func (*AppLock) GetOwner

func (l *AppLock) GetOwner() string

func (*AppLock) GetReason

func (l *AppLock) GetReason() string

func (*AppLock) MarshalJSON

func (l *AppLock) MarshalJSON() ([]byte, error)

func (*AppLock) String

func (l *AppLock) String() string

type AppRouter

type AppRouter struct {
	Name         string            `json:"name"`
	Opts         map[string]string `json:"opts"`
	Address      string            `json:"address" bson:"-"`
	Type         string            `json:"type" bson:"-"`
	Status       string            `json:"status,omitempty" bson:"-"`
	StatusDetail string            `json:"status-detail,omitempty" bson:"-"`
}

type ErrAppNotLocked

type ErrAppNotLocked struct {
	App string
}

func (ErrAppNotLocked) Error

func (e ErrAppNotLocked) Error() string

type ManyTeamsError

type ManyTeamsError struct{}

ManyTeamsError is the error returned when the user has more than one team and tries to create an app without specify a app team owner.

func (ManyTeamsError) Error

func (err ManyTeamsError) Error() string

type MockPlanService

type MockPlanService struct {
	OnCreate      func(Plan) error
	OnList        func() ([]Plan, error)
	OnFindByName  func(string) (*Plan, error)
	OnDefaultPlan func() (*Plan, error)
	OnRemove      func(string) error
}

MockPlanService implements PlanService interface

func (*MockPlanService) Create

func (m *MockPlanService) Create(plan Plan) error

func (*MockPlanService) DefaultPlan

func (m *MockPlanService) DefaultPlan() (*Plan, error)

func (*MockPlanService) FindByName

func (m *MockPlanService) FindByName(name string) (*Plan, error)

func (*MockPlanService) List

func (m *MockPlanService) List() ([]Plan, error)

func (*MockPlanService) Remove

func (m *MockPlanService) Remove(name string) error

type MockPlanStorage

type MockPlanStorage struct {
	OnInsert      func(Plan) error
	OnFindAll     func() ([]Plan, error)
	OnFindDefault func() (*Plan, error)
	OnFindByName  func(string) (*Plan, error)
	OnDelete      func(Plan) error
}

MockPlanStorage implements PlanStorage interface

func (*MockPlanStorage) Delete

func (m *MockPlanStorage) Delete(p Plan) error

func (*MockPlanStorage) FindAll

func (m *MockPlanStorage) FindAll() ([]Plan, error)

func (*MockPlanStorage) FindByName

func (m *MockPlanStorage) FindByName(name string) (*Plan, error)

func (*MockPlanStorage) FindDefault

func (m *MockPlanStorage) FindDefault() (*Plan, error)

func (*MockPlanStorage) Insert

func (m *MockPlanStorage) Insert(p Plan) error

type MockPlatformService

type MockPlatformService struct {
	OnCreate     func(PlatformOptions) error
	OnList       func(bool) ([]Platform, error)
	OnFindByName func(string) (*Platform, error)
	OnUpdate     func(PlatformOptions) error
	OnRemove     func(string) error
	OnRollback   func(PlatformOptions) error
}

MockPlatformService implements PlatformService interface

func (*MockPlatformService) Create

func (m *MockPlatformService) Create(opts PlatformOptions) error

func (*MockPlatformService) FindByName

func (m *MockPlatformService) FindByName(name string) (*Platform, error)

func (*MockPlatformService) List

func (m *MockPlatformService) List(enabledOnly bool) ([]Platform, error)

func (*MockPlatformService) Remove

func (m *MockPlatformService) Remove(name string) error

func (*MockPlatformService) Rollback

func (m *MockPlatformService) Rollback(opts PlatformOptions) error

func (*MockPlatformService) Update

func (m *MockPlatformService) Update(opts PlatformOptions) error

type MockPlatformStorage

type MockPlatformStorage struct {
	OnInsert      func(Platform) error
	OnFindByName  func(string) (*Platform, error)
	OnFindAll     func() ([]Platform, error)
	OnFindEnabled func() ([]Platform, error)
	OnUpdate      func(Platform) error
	OnDelete      func(Platform) error
}

MockPlatformStorage implements PlatformStorage interface

func (*MockPlatformStorage) Delete

func (m *MockPlatformStorage) Delete(p Platform) error

func (*MockPlatformStorage) FindAll

func (m *MockPlatformStorage) FindAll() ([]Platform, error)

func (*MockPlatformStorage) FindByName

func (m *MockPlatformStorage) FindByName(name string) (*Platform, error)

func (*MockPlatformStorage) FindEnabled

func (m *MockPlatformStorage) FindEnabled() ([]Platform, error)

func (*MockPlatformStorage) Insert

func (m *MockPlatformStorage) Insert(p Platform) error

func (*MockPlatformStorage) Update

func (m *MockPlatformStorage) Update(p Platform) error

type NoTeamsError

type NoTeamsError struct{}

NoTeamsError is the error returned when one tries to create an app without any team.

func (NoTeamsError) Error

func (err NoTeamsError) Error() string

type Plan

type Plan struct {
	Name     string `json:"name"`
	Memory   int64  `json:"memory"`
	Swap     int64  `json:"swap"`
	CpuShare int    `json:"cpushare"`
	Default  bool   `json:"default,omitempty"`
}

type PlanService

type PlanService interface {
	Create(plan Plan) error
	List() ([]Plan, error)
	FindByName(name string) (*Plan, error)
	DefaultPlan() (*Plan, error)
	Remove(planName string) error
}

type PlanStorage

type PlanStorage interface {
	Insert(Plan) error
	FindAll() ([]Plan, error)
	FindDefault() (*Plan, error)
	FindByName(string) (*Plan, error)
	Delete(Plan) error
}

type PlanValidationError

type PlanValidationError struct {
	Field string
}

func (PlanValidationError) Error

func (p PlanValidationError) Error() string

type Platform

type Platform struct {
	Name     string
	Disabled bool
}

type PlatformOptions

type PlatformOptions struct {
	Name      string
	ImageName string
	Args      map[string]string
	Input     io.Reader
	Output    io.Writer
	Data      []byte
	Ctx       context.Context
}

type PlatformService

type PlatformService interface {
	Create(PlatformOptions) error
	List(bool) ([]Platform, error)
	FindByName(string) (*Platform, error)
	Update(PlatformOptions) error
	Remove(string) error
	Rollback(PlatformOptions) error
}

type PlatformStorage

type PlatformStorage interface {
	Insert(Platform) error
	FindByName(string) (*Platform, error)
	FindAll() ([]Platform, error)
	FindEnabled() ([]Platform, error)
	Update(Platform) error
	Delete(Platform) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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