Documentation ¶
Index ¶
- Variables
- func IsInvalidVersionError(err error) bool
- type AddVersionDataArgs
- type App
- type AppCreationError
- type AppLock
- type AppLogService
- type AppLogServiceInstance
- type AppLogServiceProvision
- type AppRouter
- type AppService
- type AppVersion
- type AppVersionInfo
- type AppVersionService
- type AppVersionStorage
- type AppVersionWriteOptions
- type AppVersions
- type Applog
- type CPUBurst
- type ErrInvalidVersion
- type Filter
- type ListLogArgs
- type LogWatcher
- type ManyTeamsError
- type Metadata
- type MetadataItem
- type MockApp
- func (a *MockApp) GetDeploys() uint
- func (a *MockApp) GetName() string
- func (a *MockApp) GetPlatform() string
- func (a *MockApp) GetPlatformVersion() string
- func (a *MockApp) GetPool() string
- func (a *MockApp) GetRegistry() (imgTypes.ImageRegistry, error)
- func (a *MockApp) GetTeamOwner() string
- func (a *MockApp) GetTeamsName() []string
- func (a *MockApp) GetUpdatePlatform() bool
- type MockAppLogService
- func (m *MockAppLogService) Add(appName, message, source, unit string) error
- func (m *MockAppLogService) Enqueue(entry *Applog) error
- func (m *MockAppLogService) List(ctx context.Context, args ListLogArgs) ([]Applog, error)
- func (m *MockAppLogService) Watch(ctx context.Context, args ListLogArgs) (LogWatcher, error)
- type MockAppService
- type MockLogWatcher
- type MockPlanService
- func (m *MockPlanService) Create(ctx context.Context, plan Plan) error
- func (m *MockPlanService) DefaultPlan(ctx context.Context) (*Plan, error)
- func (m *MockPlanService) FindByName(ctx context.Context, name string) (*Plan, error)
- func (m *MockPlanService) List(ctx context.Context) ([]Plan, error)
- func (m *MockPlanService) Remove(ctx context.Context, name string) error
- type MockPlanStorage
- func (m *MockPlanStorage) Delete(ctx context.Context, p Plan) error
- func (m *MockPlanStorage) FindAll(ctx context.Context) ([]Plan, error)
- func (m *MockPlanStorage) FindByName(ctx context.Context, name string) (*Plan, error)
- func (m *MockPlanStorage) FindDefault(ctx context.Context) (*Plan, error)
- func (m *MockPlanStorage) Insert(ctx context.Context, p Plan) error
- type MockPlatformService
- func (m *MockPlatformService) Create(ctx context.Context, opts PlatformOptions) error
- func (m *MockPlatformService) FindByName(ctx context.Context, name string) (*Platform, error)
- func (m *MockPlatformService) List(ctx context.Context, enabledOnly bool) ([]Platform, error)
- func (m *MockPlatformService) Remove(ctx context.Context, name string) error
- func (m *MockPlatformService) Rollback(ctx context.Context, opts PlatformOptions) error
- func (m *MockPlatformService) Update(ctx context.Context, opts PlatformOptions) error
- type MockPlatformStorage
- func (m *MockPlatformStorage) Delete(ctx context.Context, p Platform) error
- func (m *MockPlatformStorage) FindAll(ctx context.Context) ([]Platform, error)
- func (m *MockPlatformStorage) FindByName(ctx context.Context, name string) (*Platform, error)
- func (m *MockPlatformStorage) FindEnabled(ctx context.Context) ([]Platform, error)
- func (m *MockPlatformStorage) Insert(ctx context.Context, p Platform) error
- func (m *MockPlatformStorage) Update(ctx context.Context, p Platform) error
- type NewVersionArgs
- type NoTeamsError
- type Plan
- type PlanOverride
- type PlanService
- type PlanStorage
- type PlanValidationError
- type Platform
- type PlatformOptions
- type PlatformService
- type PlatformStorage
- type Process
- type RoutableAddresses
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") 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 ¶
func IsInvalidVersionError ¶
Types ¶
type AddVersionDataArgs ¶
type AppCreationError ¶
func (*AppCreationError) Error ¶
func (e *AppCreationError) Error() string
type AppLogService ¶
type AppLogService interface { Enqueue(entry *Applog) error Add(appName, message, source, unit string) error List(ctx context.Context, args ListLogArgs) ([]Applog, error) Watch(ctx context.Context, args ListLogArgs) (LogWatcher, error) }
type AppLogServiceInstance ¶
type AppLogServiceInstance interface {
Instance() AppLogService
}
type AppLogServiceProvision ¶
type AppRouter ¶
type AppRouter struct { Name string `json:"name"` Opts map[string]string `json:"opts"` Address string `json:"address" bson:"-"` Addresses []string `json:"addresses" bson:"-"` Type string `json:"type" bson:"-"` Status string `json:"status,omitempty" bson:"-"` StatusDetail string `json:"status-detail,omitempty" bson:"-"` }
type AppService ¶
type AppVersion ¶
type AppVersion interface { Version() int BuildImageName() (string, error) CommitBuildImage() error BaseImageName() (string, error) CommitBaseImage() error CommitSuccessful() error MarkToRemoval() error VersionInfo() AppVersionInfo Processes() (map[string][]string, error) TsuruYamlData() (provTypes.TsuruYamlData, error) WebProcess() (string, error) AddData(AddVersionDataArgs) error String() string ToggleEnabled(enabled bool, reason string) error UpdatePastUnits(process string, replicas int) error }
type AppVersionInfo ¶
type AppVersionInfo struct { Version int `json:"version"` Description string `json:"description"` BuildImage string `json:"buildImage"` DeployImage string `json:"deployImage"` CustomBuildTag string `json:"customBuildTag"` CustomData map[string]interface{} `json:"customData"` Processes map[string][]string `json:"processes"` ExposedPorts []string `json:"exposedPorts"` EventID string `json:"eventID"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DisabledReason string `json:"disabledReason"` Disabled bool `json:"disabled"` DeploySuccessful bool `json:"deploySuccessful"` MarkedToRemoval bool `json:"markedToRemoval"` PastUnits map[string]int `json:"pastUnits"` }
type AppVersionService ¶
type AppVersionService interface { VersionByPendingImage(ctx context.Context, app App, imageID string) (AppVersion, error) VersionByImageOrVersion(ctx context.Context, app App, image string) (AppVersion, error) LatestSuccessfulVersion(ctx context.Context, app App) (AppVersion, error) NewAppVersion(ctx context.Context, args NewVersionArgs) (AppVersion, error) AppVersionFromInfo(context.Context, App, AppVersionInfo) (AppVersion, error) // contains filtered or unexported methods }
type AppVersionStorage ¶
type AppVersionStorage interface { UpdateVersion(ctx context.Context, appName string, vi *AppVersionInfo, opts ...*AppVersionWriteOptions) error UpdateVersionSuccess(ctx context.Context, appName string, vi *AppVersionInfo, opts ...*AppVersionWriteOptions) error NewAppVersion(ctx context.Context, args NewVersionArgs) (*AppVersionInfo, error) // contains filtered or unexported methods }
type AppVersionWriteOptions ¶
type AppVersionWriteOptions struct { // PreviousUpdatedHash is used to avoid a race of updates and loss data by concurrent updates. PreviousUpdatedHash string }
type AppVersions ¶
type AppVersions struct { AppName string `json:"appName"` Count int `json:"count"` LastSuccessfulVersion int `json:"lastSuccessfulVersion"` Versions map[int]AppVersionInfo `json:"versions"` UpdatedAt time.Time `json:"updatedAt"` UpdatedHash string `json:"updatedHash"` MarkedToRemoval bool `json:"markedToRemoval"` }
type Applog ¶
type Applog struct { MongoID bson.ObjectId `bson:"_id,omitempty" json:"-"` Date time.Time Message string Source string Name string Type logTypes.LogType Unit string }
Applog represents a log entry.
type ErrInvalidVersion ¶
type ErrInvalidVersion struct {
Version string
}
func (ErrInvalidVersion) Error ¶
func (i ErrInvalidVersion) Error() string
type ListLogArgs ¶
type LogWatcher ¶
type LogWatcher interface { Chan() <-chan Applog Close() }
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 Metadata ¶
type Metadata struct { Labels []MetadataItem `json:"labels"` Annotations []MetadataItem `json:"annotations"` }
Metadata represents the user defined labels and annotations
type MetadataItem ¶
type MetadataItem struct { Name string `json:"name"` Value string `json:"value,omitempty"` Delete bool `json:"delete,omitempty" bson:"-"` }
MetadataItem is a Name-Value structure
type MockApp ¶
type MockApp struct {
Name, TeamOwner, Platform, PlatformVersion, Pool string
Deploys uint
UpdatePlatform bool
TeamsName []string
Registry imgTypes.ImageRegistry
}
func (*MockApp) GetDeploys ¶
func (*MockApp) GetPlatform ¶
func (*MockApp) GetPlatformVersion ¶
func (*MockApp) GetRegistry ¶
func (a *MockApp) GetRegistry() (imgTypes.ImageRegistry, error)
func (*MockApp) GetTeamOwner ¶
func (*MockApp) GetTeamsName ¶
func (*MockApp) GetUpdatePlatform ¶
type MockAppLogService ¶
type MockAppLogService struct{}
func (*MockAppLogService) Add ¶
func (m *MockAppLogService) Add(appName, message, source, unit string) error
func (*MockAppLogService) Enqueue ¶
func (m *MockAppLogService) Enqueue(entry *Applog) error
func (*MockAppLogService) List ¶
func (m *MockAppLogService) List(ctx context.Context, args ListLogArgs) ([]Applog, error)
func (*MockAppLogService) Watch ¶
func (m *MockAppLogService) Watch(ctx context.Context, args ListLogArgs) (LogWatcher, error)
type MockAppService ¶
type MockLogWatcher ¶
type MockLogWatcher struct {
// contains filtered or unexported fields
}
func NewMockLogWatcher ¶
func NewMockLogWatcher() *MockLogWatcher
func (*MockLogWatcher) Chan ¶
func (m *MockLogWatcher) Chan() <-chan Applog
func (*MockLogWatcher) Close ¶
func (m *MockLogWatcher) Close()
func (*MockLogWatcher) Enqueue ¶
func (m *MockLogWatcher) Enqueue(log Applog)
type MockPlanService ¶
type MockPlanService struct { Plans []Plan 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(ctx context.Context, plan Plan) error
func (*MockPlanService) DefaultPlan ¶
func (m *MockPlanService) DefaultPlan(ctx context.Context) (*Plan, error)
func (*MockPlanService) FindByName ¶
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(ctx context.Context, p Plan) error
func (*MockPlanStorage) FindAll ¶
func (m *MockPlanStorage) FindAll(ctx context.Context) ([]Plan, error)
func (*MockPlanStorage) FindByName ¶
func (*MockPlanStorage) FindDefault ¶
func (m *MockPlanStorage) FindDefault(ctx context.Context) (*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(ctx context.Context, opts PlatformOptions) error
func (*MockPlatformService) FindByName ¶
func (*MockPlatformService) Remove ¶
func (m *MockPlatformService) Remove(ctx context.Context, name string) error
func (*MockPlatformService) Rollback ¶
func (m *MockPlatformService) Rollback(ctx context.Context, opts PlatformOptions) error
func (*MockPlatformService) Update ¶
func (m *MockPlatformService) Update(ctx context.Context, 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(ctx context.Context, p Platform) error
func (*MockPlatformStorage) FindAll ¶
func (m *MockPlatformStorage) FindAll(ctx context.Context) ([]Platform, error)
func (*MockPlatformStorage) FindByName ¶
func (*MockPlatformStorage) FindEnabled ¶
func (m *MockPlatformStorage) FindEnabled(ctx context.Context) ([]Platform, error)
type NewVersionArgs ¶
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"` CPUMilli int `json:"cpumilli"` CPUBurst CPUBurst `json:"cpuBurst,omitempty"` Default bool `json:"default,omitempty"` Override PlanOverride `json:"override,omitempty"` }
func (Plan) GetCPUBurst ¶
func (Plan) GetMilliCPU ¶
func (*Plan) MergeOverride ¶
func (p *Plan) MergeOverride(po PlanOverride)
type PlanOverride ¶
type PlanService ¶
type PlanStorage ¶
type PlanValidationError ¶
type PlanValidationError struct {
Field string
}
func (PlanValidationError) Error ¶
func (p PlanValidationError) Error() string
type PlatformOptions ¶
type PlatformService ¶
type PlatformService interface { Create(context.Context, PlatformOptions) error List(context.Context, bool) ([]Platform, error) FindByName(context.Context, string) (*Platform, error) Update(context.Context, PlatformOptions) error Remove(context.Context, string) error Rollback(context.Context, PlatformOptions) error }
type PlatformStorage ¶
type PlatformStorage interface { Insert(context.Context, Platform) error FindByName(context.Context, string) (*Platform, error) FindAll(context.Context) ([]Platform, error) FindEnabled(context.Context) ([]Platform, error) Update(context.Context, Platform) error Delete(context.Context, Platform) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.