app

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2017 License: Apache-2.0 Imports: 20 Imported by: 36

Documentation

Index

Constants

View Source
const (
	TeresaAnnotation = "teresa.io/app"
	TeresaTeamLabel  = "teresa.io/team"
	TeresaLastUser   = "teresa.io/last-user"
)
View Source
const (
	ProcessTypeWeb = "web"
)

Variables

View Source
var (
	ErrAlreadyExists    = status.Errorf(codes.AlreadyExists, "App already exists")
	ErrNotFound         = status.Errorf(codes.NotFound, "App not found")
	ErrProtectedEnvVar  = status.Errorf(codes.InvalidArgument, "Can't change protected env vars")
	ErrInvalidLimits    = status.Errorf(codes.InvalidArgument, "Invalid Limits")
	ErrInvalidAutoscale = status.Errorf(codes.InvalidArgument, "Invalid Autoscale")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Hostname string
}

type App

type App struct {
	Name        string     `json:"name"`
	Team        string     `json:"-"`
	ProcessType string     `json:"processType"`
	Limits      *Limits    `json:"-"`
	Autoscale   *Autoscale `json:"-"`
	EnvVars     []*EnvVar  `json:"envVars"`
}

type AppListItem

type AppListItem struct {
	Team      string
	Name      string
	Addresses []*Address
}

type AppOperations

type AppOperations struct {
	// contains filtered or unexported fields
}

func (*AppOperations) CheckPermAndGet added in v0.8.0

func (ops *AppOperations) CheckPermAndGet(user *database.User, appName string) (*App, error)

func (*AppOperations) Create

func (ops *AppOperations) Create(user *database.User, app *App) (Err error)

func (*AppOperations) Delete added in v0.8.0

func (ops *AppOperations) Delete(user *database.User, appName string) error

func (*AppOperations) Get

func (ops *AppOperations) Get(appName string) (*App, error)

func (*AppOperations) HasPermission

func (ops *AppOperations) HasPermission(user *database.User, appName string) bool

func (*AppOperations) Info

func (ops *AppOperations) Info(user *database.User, appName string) (*Info, error)

func (*AppOperations) List

func (ops *AppOperations) List(user *database.User) ([]*AppListItem, error)

func (*AppOperations) Logs

func (ops *AppOperations) Logs(user *database.User, appName string, lines int64, follow bool) (io.ReadCloser, error)

func (*AppOperations) SaveApp added in v0.8.0

func (ops *AppOperations) SaveApp(app *App, lastUser string) error

func (*AppOperations) SetAutoscale added in v0.7.0

func (ops *AppOperations) SetAutoscale(user *database.User, appName string, as *Autoscale) error

func (*AppOperations) SetEnv

func (ops *AppOperations) SetEnv(user *database.User, appName string, evs []*EnvVar) error

func (*AppOperations) TeamName

func (ops *AppOperations) TeamName(appName string) (string, error)

func (*AppOperations) UnsetEnv

func (ops *AppOperations) UnsetEnv(user *database.User, appName string, evNames []string) error

type Autoscale added in v0.7.0

type Autoscale struct {
	CPUTargetUtilization int32
	Max                  int32
	Min                  int32
}

type EnvVar

type EnvVar struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type FakeOperations

type FakeOperations struct {
	Storage map[string]*App
	// contains filtered or unexported fields
}

func (*FakeOperations) CheckPermAndGet added in v0.8.0

func (f *FakeOperations) CheckPermAndGet(user *database.User, appName string) (*App, error)

func (*FakeOperations) Create

func (f *FakeOperations) Create(user *database.User, app *App) error

func (*FakeOperations) Delete added in v0.8.0

func (f *FakeOperations) Delete(user *database.User, appName string) error

func (*FakeOperations) Get

func (f *FakeOperations) Get(appName string) (*App, error)

func (*FakeOperations) HasPermission

func (f *FakeOperations) HasPermission(user *database.User, appName string) bool

func (*FakeOperations) Info

func (f *FakeOperations) Info(user *database.User, appName string) (*Info, error)

func (*FakeOperations) List

func (f *FakeOperations) List(user *database.User) ([]*AppListItem, error)

func (*FakeOperations) Logs

func (f *FakeOperations) Logs(user *database.User, appName string, lines int64, follow bool) (io.ReadCloser, error)

func (*FakeOperations) SaveApp added in v0.8.0

func (f *FakeOperations) SaveApp(app *App, lastUser string) error

func (*FakeOperations) SetAutoscale added in v0.7.0

func (f *FakeOperations) SetAutoscale(user *database.User, appName string, as *Autoscale) error

func (*FakeOperations) SetEnv

func (f *FakeOperations) SetEnv(user *database.User, appName string, envVars []*EnvVar) error

func (*FakeOperations) TeamName

func (f *FakeOperations) TeamName(appName string) (string, error)

func (*FakeOperations) UnsetEnv

func (f *FakeOperations) UnsetEnv(user *database.User, appName string, envVars []string) error

type Info

type Info struct {
	Team      string
	Addresses []*Address
	EnvVars   []*EnvVar
	Status    *Status
	Autoscale *Autoscale
	Limits    *Limits
}

type K8sOperations

type K8sOperations interface {
	NamespaceAnnotation(namespace, annotation string) (string, error)
	NamespaceLabel(namespace, label string) (string, error)
	PodList(namespace string) ([]*Pod, error)
	PodLogs(namespace, podName string, lines int64, follow bool) (io.ReadCloser, error)
	CreateNamespace(app *App, userEmail string) error
	CreateQuota(app *App) error
	CreateSecret(appName, secretName string, data map[string][]byte) error
	CreateOrUpdateAutoscale(app *App) error
	AddressList(namespace string) ([]*Address, error)
	Status(namespace string) (*Status, error)
	Autoscale(namespace string) (*Autoscale, error)
	Limits(namespace, name string) (*Limits, error)
	IsNotFound(err error) bool
	IsAlreadyExists(err error) bool
	SetNamespaceAnnotations(namespace string, annotations map[string]string) error
	DeleteDeployEnvVars(namespace, name string, evNames []string) error
	CreateOrUpdateDeployEnvVars(namespace, name string, evs []*EnvVar) error
	DeleteNamespace(namespace string) error
	NamespaceListByLabel(label, value string) ([]string, error)
}

type LimitRangeQuantity

type LimitRangeQuantity struct {
	Quantity string
	Resource string
}

type Limits

type Limits struct {
	Default        []*LimitRangeQuantity
	DefaultRequest []*LimitRangeQuantity
}

type Operations

type Operations interface {
	Create(user *database.User, app *App) error
	Logs(user *database.User, appName string, lines int64, follow bool) (io.ReadCloser, error)
	Info(user *database.User, appName string) (*Info, error)
	TeamName(appName string) (string, error)
	Get(appName string) (*App, error)
	HasPermission(user *database.User, appName string) bool
	SetEnv(user *database.User, appName string, evs []*EnvVar) error
	UnsetEnv(user *database.User, appName string, evs []string) error
	List(user *database.User) ([]*AppListItem, error)
	SetAutoscale(user *database.User, appName string, as *Autoscale) error
	CheckPermAndGet(user *database.User, appName string) (*App, error)
	SaveApp(app *App, lastUser string) error
	Delete(user *database.User, appName string) error
}

func NewFakeOperations

func NewFakeOperations() Operations

func NewOperations

func NewOperations(tops team.Operations, kops K8sOperations, st st.Storage) Operations

type Pod

type Pod struct {
	Name     string
	State    string
	Age      int64
	Restarts int32
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(ops Operations) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *appb.CreateRequest) (*appb.Empty, error)

func (*Service) Delete added in v0.8.0

func (s *Service) Delete(ctx context.Context, req *appb.DeleteRequest) (*appb.Empty, error)

func (*Service) Info

func (s *Service) Info(ctx context.Context, req *appb.InfoRequest) (*appb.InfoResponse, error)

func (*Service) List

func (s *Service) List(ctx context.Context, _ *appb.Empty) (*appb.ListResponse, error)

func (*Service) Logs

func (s *Service) Logs(req *appb.LogsRequest, stream appb.App_LogsServer) error

func (*Service) RegisterService

func (s *Service) RegisterService(grpcServer *grpc.Server)

func (*Service) SetAutoscale added in v0.7.0

func (s *Service) SetAutoscale(ctx context.Context, req *appb.SetAutoscaleRequest) (*appb.Empty, error)

func (*Service) SetEnv

func (s *Service) SetEnv(ctx context.Context, req *appb.SetEnvRequest) (*appb.Empty, error)

func (*Service) UnsetEnv

func (s *Service) UnsetEnv(ctx context.Context, req *appb.UnsetEnvRequest) (*appb.Empty, error)

type Status

type Status struct {
	CPU  int32
	Pods []*Pod
}

Jump to

Keyboard shortcuts

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