Documentation ¶
Index ¶
- Constants
- type App
- type AppID
- type AppWrapper
- type AppsResponse
- type Config
- type DeleteResponse
- type FailCounter
- type Group
- type GroupID
- type GroupsResponse
- type HealthCheckResult
- type LeaderResponse
- type MStub
- func (m MStub) AppDelete(appID AppID) error
- func (m MStub) AppGet(appID AppID) (*App, error)
- func (m MStub) AppScaleDown(app *App) error
- func (m MStub) AppsGet() ([]*App, error)
- func (m MStub) AuthGet() *url.Userinfo
- func (m MStub) GetAppIDPrefix() string
- func (m MStub) GetEmptyLeafGroups() ([]*Group, error)
- func (m MStub) GroupDelete(groupID GroupID) error
- func (m MStub) GroupsGet() ([]*Group, error)
- func (m MStub) LeaderGet() (string, error)
- func (m MStub) LocationGet() string
- func (m MStub) TasksGet(appID AppID) ([]*Task, error)
- type Marathon
- func (m Marathon) AppDelete(app AppID) error
- func (m Marathon) AppGet(appID AppID) (*App, error)
- func (m Marathon) AppScaleDown(app *App) error
- func (m Marathon) AppsGet() ([]*App, error)
- func (m Marathon) AuthGet() *url.Userinfo
- func (m Marathon) GetAppIDPrefix() string
- func (m Marathon) GetEmptyLeafGroups() ([]*Group, error)
- func (m Marathon) GroupDelete(group GroupID) error
- func (m Marathon) LeaderGet() (string, error)
- func (m Marathon) LocationGet() string
- func (m Marathon) TasksGet(appID AppID) ([]*Task, error)
- type Marathoner
- type ScaleCounter
- type ScaleData
- type ScaleResponse
- type Task
- type TaskID
- type TasksResponse
- type VersionInfo
Constants ¶
const ApplicationImmunityLabel = "APP_IMMUNITY"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Labels map[string]string `json:"labels"` ID AppID `json:"id"` Tasks []Task `json:"tasks"` Instances int `json:"instances"` VersionInfo VersionInfo `json:"versionInfo"` }
App represents application returned in marathon json
func (App) HasImmunity ¶
HasImmunity check if application behavior is tolerated without consequence
type AppID ¶
type AppID string
AppID Marathon Application Id (aka PathId) Usually in the form of /rootGroup/subGroup/subSubGroup/name allowed characters: lowercase letters, digits, hyphens, slash
type AppWrapper ¶
type AppWrapper struct {
App App `json:"app"`
}
AppWrapper json returned from marathon with app definition
type AppsResponse ¶
type AppsResponse struct {
Apps []*App `json:"apps"`
}
AppsResponse json returned from marathon with apps definitions
type Config ¶
type Config struct { Location string Protocol string Username string Password string // AppIDPrefix is a part of application id preferably present // in all applications in marathon, if found it is removed for the sake of // making applications paths shorter. // By default this string is empty and no prefix is considered. AppIDPrefix string VerifySsl bool Timeout time.Duration }
Config contains marathon module specific configuration
type DeleteResponse ¶
type DeleteResponse struct { Version string `json:"version"` DeploymentID string `json:"deploymentId"` }
DeleteResponse represents marathon response from scaling request
type FailCounter ¶
type FailCounter struct {
Counter int
}
FailCounter is structure to hold state between failures
type Group ¶
type Group struct { Apps []*App `json:"apps"` Groups []*Group `json:"groups"` ID GroupID `json:"id"` Version string `json:"version"` }
Group represents application returned in Marathon json
type GroupsResponse ¶
type GroupsResponse struct {
Groups []*Group `json:"groups"`
}
GroupsResponse json returned from Marathon with apps definitions
type HealthCheckResult ¶
type HealthCheckResult struct {
Alive bool `json:"alive"`
}
HealthCheckResult returned from marathon api
type LeaderResponse ¶
type LeaderResponse struct {
Leader string `json:"leader"`
}
LeaderResponse represents marathon response from /v2/leader request
type MStub ¶
type MStub struct { Apps []*App Groups []*Group // AppGetFail - Set to true and this Stub get method will return errors AppsGetFail bool // AppDelFail - Set to true and this Stub methods will return error AppDelFail bool // AppDelHalfFail - Set to true and this Stub methods will return error at each second call AppDelHalfFail bool GroupDelFail bool AppScaleDownFail bool FailCounter *FailCounter ScaleCounter *ScaleCounter }
MStub is a stub for marathon functionality
func (MStub) AppScaleDown ¶
AppScaleDown by one instance
func (MStub) GetAppIDPrefix ¶
func (MStub) GetEmptyLeafGroups ¶
GetEmptyLeafGroups returns groups from marathon which are leafs in group tree
func (MStub) GroupDelete ¶
GroupDelete by provided GroupID
type Marathon ¶
type Marathon struct { Location string Protocol string Auth *url.Userinfo // contains filtered or unexported fields }
Marathon reciever
func (Marathon) AppScaleDown ¶
AppScaleDown scales down app by provided AppID
func (Marathon) GetAppIDPrefix ¶
func (Marathon) GetEmptyLeafGroups ¶
GetEmptyLeafGroups returns groups which are leafs of groups directory and only if they are empty (no apps inside).
func (Marathon) GroupDelete ¶
GroupDelete scales down app by provided AppID
func (Marathon) LocationGet ¶
LocationGet from marathon configured instance
type Marathoner ¶
type Marathoner interface { AppGet(AppID) (*App, error) AppsGet() ([]*App, error) TasksGet(AppID) ([]*Task, error) AuthGet() *url.Userinfo LocationGet() string LeaderGet() (string, error) AppScaleDown(*App) error AppDelete(AppID) error GroupDelete(GroupID) error GetEmptyLeafGroups() ([]*Group, error) GetAppIDPrefix() string }
Marathoner interfacing marathon
type ScaleCounter ¶
type ScaleCounter struct {
Counter int
}
ScaleCounter is counting scaling operations
type ScaleResponse ¶
type ScaleResponse struct { Version string `json:"version"` DeploymentID string `json:"deploymentId"` }
ScaleResponse represents marathon response from scaling request
type Task ¶
type Task struct { ID TaskID TaskStatus string `json:"taskStatus"` AppID AppID `json:"appId"` Host string `json:"host"` Ports []int `json:"ports"` HealthCheckResults []HealthCheckResult `json:"healthCheckResults"` }
Task definition returned in marathon event
func ParseTasks ¶
ParseTasks try to convert raw Tasks data to json
type TaskID ¶
type TaskID string
TaskID from marathon Usually in the form of AppID.uuid with '/' replaced with '_'
type TasksResponse ¶
type TasksResponse struct {
Tasks []*Task `json:"tasks"`
}
TasksResponse response to TasksGet call
type VersionInfo ¶
type VersionInfo struct { LastScalingAt string `json:"lastScalingAt"` LastConfigChangeAt string `json:"lastConfigChangeAt"` }
VersionInfo represents json field of this name, inside marathon app definition