api

package
v0.0.0-...-b544bfe Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_PREFIX = "v_beta"
)

Variables

This section is empty.

Functions

func CheckVersion

func CheckVersion(version *types.Version) error

Types

type App

type App struct {
	ID               string    `json:"id,omitempty"`
	Name             string    `json:"name,omitempty"`
	Instances        int       `json:"instances,omitempty"`
	UpdatedInstances int       `json:"updatedInstances,omitempty"`
	RunningInstances int       `json:"runningInstances"`
	RunAs            string    `json:"runAs,omitempty"`
	Priority         int       `json:"priority"`
	ClusterId        string    `json:"clusterId,omitempty"`
	Status           string    `json:"status,omitempty"`
	Created          time.Time `json:"created,omitempty"`
	Updated          time.Time `json:"updated,omitempty"`
	Mode             string    `json:"mode,omitempty"`
	State            string    `json:"state"`

	// use task for compatability now, should be slot here
	Tasks    []*Task  `json:"tasks,omitempty"`
	Versions []string `json:"versions,omitempty"`
	IP       []string `json:"ip,omitempty"`

	// current version related info
	Labels      map[string]string `json:"labels,omitempty"`
	Env         map[string]string `json:"env,omitempty"`
	Constraints []string          `json:"constraints,omitempty"`
	Uris        []string          `json:"uris,omitempty"`
}

func FormAppRet

func FormAppRet(app *state.App) *App

type AppService

type AppService struct {
	Scheduler *scheduler.Scheduler
	apiserver.ApiRegister
}

func NewAndInstallAppService

func NewAndInstallAppService(apiServer *apiserver.ApiServer, eng *scheduler.Scheduler) *AppService

func (*AppService) CancelUpdate

func (api *AppService) CancelUpdate(request *restful.Request, response *restful.Response)

func (*AppService) CreateApp

func (api *AppService) CreateApp(request *restful.Request, response *restful.Response)

func (*AppService) DeleteApp

func (api *AppService) DeleteApp(request *restful.Request, response *restful.Response)

func (*AppService) GetApp

func (api *AppService) GetApp(request *restful.Request, response *restful.Response)

func (*AppService) GetAppTask

func (api *AppService) GetAppTask(request *restful.Request, response *restful.Response)

func (*AppService) ListApp

func (api *AppService) ListApp(request *restful.Request, response *restful.Response)

func (*AppService) ProceedUpdate

func (api *AppService) ProceedUpdate(request *restful.Request, response *restful.Response)

func (*AppService) Register

func (api *AppService) Register(container *restful.Container)

NOTE(xychu): Every service need to registed to ApiServer need to impl

a `Register` interface so that it can be added to ApiServer.Start

func (*AppService) ScaleDown

func (api *AppService) ScaleDown(request *restful.Request, response *restful.Response)

func (*AppService) ScaleUp

func (api *AppService) ScaleUp(request *restful.Request, response *restful.Response)

func (*AppService) UpdateApp

func (api *AppService) UpdateApp(request *restful.Request, response *restful.Response)

type Cmd

type Cmd struct {
}

func NewCmd

func NewCmd() *Cmd

type EventsService

type EventsService struct {
	Scheduler *scheduler.Scheduler
	apiserver.ApiRegister
}

func NewAndInstallEventsService

func NewAndInstallEventsService(apiServer *apiserver.ApiServer, eng *scheduler.Scheduler) *EventsService

func (*EventsService) Events

func (api *EventsService) Events(request *restful.Request, response *restful.Response)

func (*EventsService) Register

func (api *EventsService) Register(container *restful.Container)

type ProceedUpdateParam

type ProceedUpdateParam struct {
	Instances int `json:"instances"`
}

type ScaleDownParam

type ScaleDownParam struct {
	Instances int `json:"instances"`
}

type ScaleUpParam

type ScaleUpParam struct {
	Instances int      `json:"instances"`
	IPs       []string `json:"ips"`
}

type Stats

type Stats struct {
	AppCount  int `json:"appCount,omitempty"`
	TaskCount int `json:"taskCount,omitempty"`

	CpuTotalOffered  float64 `json:"cpuTotalOffered,omitempty"`
	MemTotalOffered  float64 `json:"memTotalOffered,omitempty"`
	DiskTotalOffered float64 `json:"diskTotalOffered,omitempty"`

	CpuTotalUsed  float64 `json:"cpuTotalUsed,omitempty"`
	MemTotalUsed  float64 `json:"memTotalUsed,omitempty"`
	DiskTotalUsed float64 `json:"diskTotalUsed,omitempty"`

	AppStats map[string]int `json:"appStats,omitempty"`
}

type StatsService

type StatsService struct {
	Scheduler *scheduler.Scheduler
	apiserver.ApiRegister
}

func NewAndInstallStatsService

func NewAndInstallStatsService(apiServer *apiserver.ApiServer, eng *scheduler.Scheduler) *StatsService

func (*StatsService) Register

func (api *StatsService) Register(container *restful.Container)

func (*StatsService) Stats

func (api *StatsService) Stats(request *restful.Request, response *restful.Response)

type Task

type Task struct {
	ID        string `json:"id,omitempty"`
	AppId     string `json:"appId,omitempty"`
	VersionId string `json:"versionId,omitempty"`

	Status string `json:"status"`

	OfferId       string `json:"offerId,omitempty"`
	AgentId       string `json:"agentId,omitempty"`
	AgentHostname string `json:"agentHostname,omitempty"`

	Cpu  float64 `json:"cpu,omitempty"`
	Mem  float64 `json:"mem,omitempty"`
	Disk float64 `json:"disk,omitempty"`

	History []*TaskHistory `json:"history,omitempty"`

	IP string `json:"ip,omitempty"`

	Created time.Time `json:"created,omitempty"`

	Image   string `json:"image,omitempty"`
	Healthy bool   `json:"healthy"`
}

use task for compatability now, should be slot here and together with task history

func FilterTasksFromApp

func FilterTasksFromApp(app *state.App) []*Task

func GetTaskFromApp

func GetTaskFromApp(app *state.App, task_index int) (*Task, error)

type TaskHistory

type TaskHistory struct {
	ID        string `json:"id,omitempty"`
	AppId     string `json:"appId,omitempty"`
	VersionId string `json:"versionId,omitempty"`

	OfferId       string `json:"offerId,omitempty"`
	AgentId       string `json:"agentId,omitempty"`
	AgentHostname string `json:"agentHostname,omitempty"`

	Cpu  float64 `json:"cpu,omitempty"`
	Mem  float64 `json:"mem,omitempty"`
	Disk float64 `json:"disk,omitempty"`

	State  string `json:"state,omitempty"`
	Reason string `json:"Reason,omitempty"`
	Stdout string `json:"stdout,omitempty"`
	Stderr string `json:"stderr,omitempty"`
}

Jump to

Keyboard shortcuts

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