Documentation ¶
Index ¶
- Constants
- Variables
- type Application
- func (application *Application) AddEnv(name, value string) *Application
- func (application *Application) AllTaskRunning() bool
- func (application *Application) Arg(argument string) *Application
- func (application *Application) CPU(cpu float64) *Application
- func (application *Application) CheckHTTP(uri string, port, interval int) (*Application, error)
- func (application *Application) CheckTCP(port, interval int) (*Application, error)
- func (application *Application) Count(count int) *Application
- func (application *Application) DependsOn(name string) *Application
- func (application *Application) Deployments() []*DeploymentID
- func (application *Application) HasHealthChecks() bool
- func (application *Application) Memory(memory float64) *Application
- func (application *Application) Name(id string) *Application
- func (application *Application) Storage(disk float64) *Application
- type ApplicationVersion
- type ApplicationVersions
- type ApplicationWrap
- type Applications
- type AtomicSwitch
- type Client
- func (client *Client) AbdicateLeader() (string, error)
- func (client *Client) AddEventsListener(channel EventsChannel, filter int) error
- func (client *Client) AllTasks() (*Tasks, error)
- func (client *Client) Application(name string) (*Application, error)
- func (client *Client) ApplicationDeployments(name string) ([]*DeploymentID, error)
- func (client *Client) ApplicationOK(name string) (bool, error)
- func (client *Client) ApplicationVersions(name string) (*ApplicationVersions, error)
- func (client *Client) Applications(v url.Values) (*Applications, error)
- func (client *Client) CreateApplication(application *Application, wait_on_running bool) (*Application, error)
- func (client *Client) CreateGroup(group *Group, wait_on_running bool) error
- func (client *Client) DeleteApplication(name string) (*DeploymentID, error)
- func (client *Client) DeleteDeployment(id string, force bool) (*DeploymentID, error)
- func (client *Client) DeleteGroup(name string) (*DeploymentID, error)
- func (client *Client) Deployments() ([]*Deployment, error)
- func (client *Client) GetEvent(name string) (*Event, error)
- func (client *Client) GetMarathonURL() string
- func (client *Client) Group(name string) (*Group, error)
- func (client *Client) Groups() (*Groups, error)
- func (client *Client) HandleMarathonEvent(writer http.ResponseWriter, request *http.Request)
- func (client *Client) HasApplication(name string) (bool, error)
- func (client *Client) HasApplicationVersion(name, version string) (bool, error)
- func (client *Client) HasDeployment(id string) (bool, error)
- func (client *Client) HasGroup(name string) (bool, error)
- func (client *Client) HasSubscription(callback string) (bool, error)
- func (client *Client) Info() (*Info, error)
- func (client *Client) KillApplicationTasks(id, hostname string, scale bool) (*Tasks, error)
- func (client *Client) KillTask(taskId string, scale bool) (*Task, error)
- func (client *Client) KillTasks(tasks []string, scale bool) error
- func (client *Client) Leader() (string, error)
- func (client *Client) ListApplications(v url.Values) ([]string, error)
- func (client *Client) ListTasks() ([]string, error)
- func (client *Client) Ping() (bool, error)
- func (client *Client) RegisterSubscription() error
- func (client *Client) RemoveEventsListener(channel EventsChannel)
- func (client *Client) RestartApplication(name string, force bool) (*DeploymentID, error)
- func (client *Client) ScaleApplicationInstances(name string, instances int, force bool) (*DeploymentID, error)
- func (client *Client) SetApplicationVersion(name string, version *ApplicationVersion) (*DeploymentID, error)
- func (client *Client) SubscriptionURL() string
- func (client *Client) Subscriptions() (*Subscriptions, error)
- func (client *Client) TaskEndpoints(name string, port int, health_check bool) ([]string, error)
- func (client *Client) Tasks(id string) (*Tasks, error)
- func (client *Client) UnSubscribe() error
- func (client *Client) UpdateApplication(application *Application, wait_on_running bool) (*Application, error)
- func (client *Client) UpdateGroup(name string, group *Group) (*DeploymentID, error)
- func (client *Client) WaitOnApplication(name string, timeout time.Duration) error
- func (client *Client) WaitOnDeployment(id string, timeout time.Duration) error
- func (client *Client) WaitOnGroup(name string, timeout time.Duration) error
- type Cluster
- type Command
- type Config
- type Container
- type Deployment
- type DeploymentID
- type DeploymentPlan
- type DeploymentStep
- type Docker
- func (docker *Docker) Bridged() *Docker
- func (docker *Docker) Container(image string) *Docker
- func (docker *Docker) Expose(port int) *Docker
- func (docker *Docker) ExposePort(container_port, host_port, service_port int, protocol string) *Docker
- func (docker *Docker) ExposeUDP(port int) *Docker
- func (docker *Docker) Parameter(key string, value string) *Docker
- func (docker *Docker) ServicePortIndex(port int) (int, error)
- type Event
- type EventAPIRequest
- type EventAddHealthCheck
- type EventAppTerminated
- type EventDeploymentFailed
- type EventDeploymentInfo
- type EventDeploymentStepFailure
- type EventDeploymentStepSuccess
- type EventDeploymentSuccess
- type EventFailedHealthCheck
- type EventFrameworkMessage
- type EventGroupChangeFailed
- type EventGroupChangeSuccess
- type EventHealthCheckChanged
- type EventRemoveHealthCheck
- type EventStatusUpdate
- type EventSubscription
- type EventType
- type EventUnsubscription
- type EventsChannel
- type Group
- type Groups
- type HealthCheck
- type HealthCheckResult
- type Info
- type LastTaskFailure
- type Marathon
- type MarathonCluster
- func (cluster *MarathonCluster) Active() []string
- func (cluster *MarathonCluster) ClusterState() []string
- func (cluster *MarathonCluster) GetMarathonURL(member *Member) string
- func (cluster *MarathonCluster) GetMember() (string, error)
- func (cluster *MarathonCluster) MarkDown()
- func (cluster *MarathonCluster) NonActive() []string
- func (cluster *MarathonCluster) Size() int
- func (cluster MarathonCluster) String() string
- func (cluster *MarathonCluster) Url() string
- type Member
- type Message
- type Parameters
- type PortMapping
- type Subscriptions
- type Task
- type Tasks
- type UpgradeStrategy
- type Volume
Constants ¶
const ( HTTP_GET = "GET" HTTP_PUT = "PUT" HTTP_DELETE = "DELETE" HTTP_POST = "POST" )
const ( MEMBER_AVAILABLE = 0 MEMBER_UNAVAILABLE = 1 )
const ( DEFAULT_EVENTS_URL = "/event" /* --- api related constants --- */ MARATHON_API_VERSION = "v2" MARATHON_API_SUBSCRIPTION = MARATHON_API_VERSION + "/eventSubscriptions" MARATHON_API_APPS = MARATHON_API_VERSION + "/apps" MARATHON_API_TASKS = MARATHON_API_VERSION + "/tasks" MARATHON_API_DEPLOYMENTS = MARATHON_API_VERSION + "/deployments" MARATHON_API_GROUPS = MARATHON_API_VERSION + "/groups" MARATHON_API_QUEUE = MARATHON_API_VERSION + "/queue" MARATHON_API_INFO = MARATHON_API_VERSION + "/info" MARATHON_API_LEADER = MARATHON_API_VERSION + "/leader" MARATHON_API_PING = "/ping" MARATHON_API_LOGGING = "/logging" MARATHON_API_HELP = "/help" MARATHON_API_METRICS = "/metrics" )
const ( EVENT_API_REQUEST = 1 << iota EVENT_STATUS_UPDATE EVENT_FRAMEWORK_MESSAGE EVENT_SUBSCRIPTION EVENT_UNSUBSCRIBED EVENT_ADD_HEALTH_CHECK EVENT_REMOVE_HEALTH_CHECK EVENT_FAILED_HEALTH_CHECK EVENT_CHANGED_HEALTH_CHECK EVENT_GROUP_CHANGE_SUCCESS EVENT_GROUP_CHANGE_FAILED EVENT_DEPLOYMENT_SUCCESS EVENT_DEPLOYMENT_FAILED EVENT_DEPLOYMENT_INFO EVENT_DEPLOYMENT_STEP_SUCCESS EVENT_DEPLOYMENT_STEP_FAILED EVENT_APP_TERMINATED )
const ( EVENTS_APPLICATIONS = EVENT_STATUS_UPDATE | EVENT_CHANGED_HEALTH_CHECK | EVENT_FAILED_HEALTH_CHECK | EVENT_APP_TERMINATED EVENTS_SUBSCRIPTIONS = EVENT_SUBSCRIPTION | EVENT_UNSUBSCRIBED )
const VERSION = "0.0.2"
Variables ¶
var ( ErrApplicationExists = errors.New("The application already exists in marathon, you must update") /* no container has been specified yet */ ErrNoApplicationContainer = errors.New("You have not specified a docker container yet") )
var ( /* the url specified was invalid */ ErrInvalidEndpoint = errors.New("Invalid Marathon endpoint specified") /* invalid or error response from marathon */ ErrInvalidResponse = errors.New("Invalid response from Marathon") /* some resource does not exists */ ErrDoesNotExist = errors.New("The resource does not exist") /* all the marathon endpoints are down */ ErrMarathonDown = errors.New("All the Marathon hosts are presently down") /* unable to decode the response */ ErrInvalidResult = errors.New("Unable to decode the response from Marathon") /* invalid argument */ ErrInvalidArgument = errors.New("The argument passed is invalid") /* error return by marathon */ ErrMarathonError = errors.New("Marathon error") /* the operation has timed out */ ErrTimeoutError = errors.New("The operation has timed out") )
var (
Events map[string]int
)
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { ID string `json:"id",omitempty` Cmd string `json:"cmd,omitempty"` Args []string `json:"args,omitempty"` Constraints [][]string `json:"constraints,omitempty"` Container *Container `json:"container,omitempty"` CPUs float64 `json:"cpus,omitempty"` Disk float64 `json:"disk,omitempty"` Env map[string]string `json:"env,omitempty"` Executor string `json:"executor,omitempty"` HealthChecks []*HealthCheck `json:"healthChecks,omitempty"` Instances int `json:"instances,omitempty"` Mem float64 `json:"mem,omitempty"` Tasks []*Task `json:"tasks,omitempty"` Ports []int `json:"ports"` RequirePorts bool `json:"requirePorts,omitempty"` BackoffSeconds float64 `json:"backoffSeconds,omitempty"` BackoffFactor float64 `json:"backoffFactor,omitempty"` MaxLaunchDelaySeconds float64 `json:"maxLaunchDelaySeconds,omitempty"` DeploymentID []map[string]string `json:"deployments,omitempty"` Dependencies []string `json:"dependencies,omitempty"` TasksRunning int `json:"tasksRunning,omitempty"` TasksStaged int `json:"tasksStaged,omitempty"` User string `json:"user,omitempty"` UpgradeStrategy *UpgradeStrategy `json:"upgradeStrategy,omitempty"` Uris []string `json:"uris,omitempty"` Version string `json:"version,omitempty"` Labels map[string]string `json:"labels,omitempty"` AcceptedResourceRoles []string `json:"acceptedResourceRoles,omitempty"` LastTaskFailure *LastTaskFailure `json:"lastTaskFailure,omitempty"` }
func NewDockerApplication ¶
func NewDockerApplication() *Application
func (*Application) AddEnv ¶
func (application *Application) AddEnv(name, value string) *Application
Add an environment variable to the application
name: the name of the variable value: go figure, the value associated to the above
func (*Application) AllTaskRunning ¶
func (application *Application) AllTaskRunning() bool
Check to see if all the application tasks are running, i.e. the instances is equal to the number of running tasks
func (*Application) Arg ¶
func (application *Application) Arg(argument string) *Application
Add an argument to the applications
argument: the argument you are adding
func (*Application) CPU ¶
func (application *Application) CPU(cpu float64) *Application
The amount of CPU shares per instance which is assigned to the application
cpu: the CPU shared (check Docker docs) per instance
func (*Application) CheckHTTP ¶
func (application *Application) CheckHTTP(uri string, port, interval int) (*Application, error)
Add an HTTP check to an application
port: the port the check should be checking interval: the interval in seconds the check should be performed
func (*Application) CheckTCP ¶
func (application *Application) CheckTCP(port, interval int) (*Application, error)
Add a TCP check to an application; note the port mapping must already exist, or an error will thrown
port: the port the check should, err, check interval: the interval in seconds the check should be performed
func (*Application) Count ¶
func (application *Application) Count(count int) *Application
Set the number of instances of the application to run
count: the number of instances to run
func (*Application) DependsOn ¶
func (application *Application) DependsOn(name string) *Application
Adds a dependency for this application. Note, if you want to wait for an application dependency to actually be UP, i.e. not just deployed, you need a health check on the dependant app.
name: the application id which this application depends on
func (*Application) Deployments ¶
func (application *Application) Deployments() []*DeploymentID
Retrieve the application deployments ID
func (*Application) HasHealthChecks ¶
func (application *Application) HasHealthChecks() bool
More of a helper method, used to check if an application has healtchecks
func (*Application) Memory ¶
func (application *Application) Memory(memory float64) *Application
The amount of memory the application can consume per instance
memory: the amount of MB to assign
func (*Application) Name ¶
func (application *Application) Name(id string) *Application
The name of the application i.e. the identifier for this application
func (*Application) Storage ¶
func (application *Application) Storage(disk float64) *Application
The amount of disk space the application is assigned, which for docker application I don't believe is relevant
disk: the disk space in MB
type ApplicationVersion ¶
type ApplicationVersion struct {
Version string `json:"version"`
}
type ApplicationVersions ¶
type ApplicationVersions struct {
Versions []string `json:"versions"`
}
type ApplicationWrap ¶
type ApplicationWrap struct {
Application Application `json:"app"`
}
type Applications ¶
type Applications struct {
Apps []Application `json:"apps"`
}
type AtomicSwitch ¶
type AtomicSwitch int64
func (*AtomicSwitch) IsSwitched ¶
func (p *AtomicSwitch) IsSwitched() bool
func (*AtomicSwitch) SwitchOn ¶
func (p *AtomicSwitch) SwitchOn()
func (*AtomicSwitch) SwitchedOff ¶
func (p *AtomicSwitch) SwitchedOff()
type Client ¶
func (*Client) AbdicateLeader ¶
func (*Client) AddEventsListener ¶
func (client *Client) AddEventsListener(channel EventsChannel, filter int) error
Add your self as a listener to events from Marathon
channel: a EventsChannel used to receive event on
func (*Client) Application ¶
func (client *Client) Application(name string) (*Application, error)
Retrieve the application configuration from marathon
name: the id used to identify the application
func (*Client) ApplicationDeployments ¶
func (client *Client) ApplicationDeployments(name string) ([]*DeploymentID, error)
Retrieve an array of Deployment IDs for an application
name: the id used to identify the application
func (*Client) ApplicationOK ¶
Validates that the application, or more appropriately it's tasks have passed all the health checks. If no health checks exist, we simply return true
name: the id used to identify the application
func (*Client) ApplicationVersions ¶
func (client *Client) ApplicationVersions(name string) (*ApplicationVersions, error)
A list of versions which has been deployed with marathon for a specific application
name: the id used to identify the application
func (*Client) Applications ¶
func (client *Client) Applications(v url.Values) (*Applications, error)
Retrieve an array of all the applications which are running in marathon
func (*Client) CreateApplication ¶
func (client *Client) CreateApplication(application *Application, wait_on_running bool) (*Application, error)
Creates a new application in Marathon
application: the structure holding the application configuration wait_on_running: waits on the application deploying, i.e. the instances arre all running (note health checks are excluded)
func (*Client) CreateGroup ¶
Create a new group in marathon
group: a pointer the Group structure defining the group
func (*Client) DeleteApplication ¶
func (client *Client) DeleteApplication(name string) (*DeploymentID, error)
Deletes an application from marathon
name: the id used to identify the application
func (*Client) DeleteDeployment ¶
func (client *Client) DeleteDeployment(id string, force bool) (*DeploymentID, error)
Delete a current deployment from marathon
id: the deployment id you wish to delete force: whether or not to force the deletion
func (*Client) DeleteGroup ¶
func (client *Client) DeleteGroup(name string) (*DeploymentID, error)
Delete a group from marathon
name: the identifier for the group
func (*Client) Deployments ¶
func (client *Client) Deployments() ([]*Deployment, error)
Retrieve a list of current deployments
func (*Client) GetMarathonURL ¶
func (*Client) Group ¶
Retrieve the configuration of a specific group from marathon
name: the identifier for the group
func (*Client) HandleMarathonEvent ¶
func (client *Client) HandleMarathonEvent(writer http.ResponseWriter, request *http.Request)
func (*Client) HasApplication ¶
Checks to see if the application exists in marathon
name: the id used to identify the application
func (*Client) HasApplicationVersion ¶
Checks to see if the application version exists in Marathon
name: the id used to identify the application version: the version (normally a timestamp) your looking for
func (*Client) HasDeployment ¶
Check to see if a deployment exists
id: the deployment id you are looking for
func (*Client) HasSubscription ¶
Check to see a subscription already exists with Marathon
callback: the url of the callback
func (*Client) KillApplicationTasks ¶
Kill all tasks relating to an application
application_id: the id for the application host: kill only those tasks on a specific host (optional) scale: Scale the app down (i.e. decrement its instances setting by the number of tasks killed) after killing the specified tasks
func (*Client) KillTask ¶
Kill the task associated with a given ID
task_id: the id for the task scale: Scale the app down
func (*Client) KillTasks ¶
Kill tasks associated with given array of ids
tasks: the array of task ids scale: Scale the app down
func (*Client) ListApplications ¶
Retrieve an array of the application names currently running in marathon
func (*Client) Ping ¶
Pings the current marathon endpoint (note, this is not a ICMP ping, but a rest api call)
func (*Client) RegisterSubscription ¶
Register ourselves with Marathon to receive events from it's callback facility
func (*Client) RemoveEventsListener ¶
func (client *Client) RemoveEventsListener(channel EventsChannel)
Remove the channel from the events listeners
channel: the channel you are removing
func (*Client) RestartApplication ¶
func (client *Client) RestartApplication(name string, force bool) (*DeploymentID, error)
Performs a rolling restart of marathon application
name: the id used to identify the application
func (*Client) ScaleApplicationInstances ¶
func (client *Client) ScaleApplicationInstances(name string, instances int, force bool) (*DeploymentID, error)
Change the number of instance an application is running
name: the id used to identify the application instances: the number of instances you wish to change to force: used to force the scale operation in case of blocked deployment
func (*Client) SetApplicationVersion ¶
func (client *Client) SetApplicationVersion(name string, version *ApplicationVersion) (*DeploymentID, error)
Change / Revert the version of the application
name: the id used to identify the application version: the version (normally a timestamp) you wish to change to
func (*Client) SubscriptionURL ¶
Retrieve the subscription call back URL used when registering
func (*Client) Subscriptions ¶
func (client *Client) Subscriptions() (*Subscriptions, error)
Retrieve a list of registered subscriptions
func (*Client) TaskEndpoints ¶
name: the identifier for the application port: the container port you are interested in health: whether to check the health or not
func (*Client) Tasks ¶
Retrieve a list of tasks for an application
application_id: the id for the application
func (*Client) UnSubscribe ¶
Remove ourselves from Marathon's callback facility
func (*Client) UpdateApplication ¶
func (client *Client) UpdateApplication(application *Application, wait_on_running bool) (*Application, error)
Updates a new application in Marathon
application: the structure holding the application configuration wait_on_running: waits on the application deploying, i.e. the instances arre all running (note health checks are excluded)
func (*Client) UpdateGroup ¶
func (client *Client) UpdateGroup(name string, group *Group) (*DeploymentID, error)
Update the parameters of a groups
name: the identifier for the group group: the group structure with the new params
func (*Client) WaitOnApplication ¶
Wait for an application to be deployed
name: the id of the application timeout: a duration of time to wait for an application to deploy
func (*Client) WaitOnDeployment ¶
Wait of a deployment to finish
version: the version of the application timeout: the timeout to wait for the deployment to take, otherwise return an error
func (*Client) WaitOnGroup ¶
Waits for all the applications in a group to be deployed
group: the identifier for the group timeout: a duration of time to wait before considering it failed (all tasks in all apps running defined as deployed)
type Cluster ¶
type Cluster interface { Url() string /* retrieve a member from the cluster */ GetMember() (string, error) /* make the last member as down */ MarkDown() /* the size of the cluster */ Size() int /* the members which are available */ Active() []string /* the members which are NOT available */ NonActive() []string }
func NewMarathonCluster ¶
type Config ¶
type Config struct { /* the url for marathon */ URL string /* event handler port */ EventsPort int /* the interface we should be listening on for events */ EventsInterface string /* the output for logging */ LogOutput io.Writer /* the timeout for requests */ RequestTimeout int /* the default timeout for deployments */ DefaultDeploymentTimeout time.Duration /* http basic auth */ HttpBasicAuthUser string /* http basic password */ HttpBasicPassword string }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type Container ¶
type Container struct { Type string `json:"type,omitempty"` Docker *Docker `json:"docker,omitempty"` Volumes []*Volume `json:"volumes,omitempty"` }
func NewDockerContainer ¶
func NewDockerContainer() *Container
type Deployment ¶
type Deployment struct { ID string `json:"id"` Version string `json:"version"` CurrentStep int `json:"currentStep"` TotalSteps int `json:"totalSteps"` AffectedApps []string `json:"affectedApps"` Steps [][]*DeploymentStep `json:"steps"` CurrentActions []*DeploymentStep `json:"currentActions"` }
type DeploymentID ¶
type DeploymentPlan ¶
type DeploymentPlan struct { ID string `json:"id"` Version string `json:"version"` Original struct { Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` ID string `json:"id"` Version string `json:"version"` } `json:"original"` Steps []*DeploymentStep `json:"steps"` Target struct { Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` ID string `json:"id"` Version string `json:"version"` } `json:"target"` }
type DeploymentStep ¶
type Docker ¶
type Docker struct { ForcePullImage bool `json:"forcePullImage,omitempty"` Image string `json:"image,omitempty"` Network string `json:"network,omitempty"` Parameters []*Parameters `json:"parameters,omitempty"` PortMappings []*PortMapping `json:"portMappings,omitempty"` Privileged bool `json:"privileged,omitempty"` }
func (*Docker) ExposePort ¶
type EventAPIRequest ¶
type EventAPIRequest struct { EventType string `json:"eventType"` ClientIp string `json:"clientIp"` Timestamp string `json:"timestamp"` Uri string `json:"uri"` AppDefinition *Application `json:"appDefinition"` }
type EventAddHealthCheck ¶
type EventAddHealthCheck struct { AppId string `json:"appId"` EventType string `json:"eventType"` HealthCheck struct { GracePeriodSeconds float64 `json:"gracePeriodSeconds"` IntervalSeconds float64 `json:"intervalSeconds"` MaxConsecutiveFailures float64 `json:"maxConsecutiveFailures"` Path string `json:"path"` PortIndex float64 `json:"portIndex"` Protocol string `json:"protocol"` TimeoutSeconds float64 `json:"timeoutSeconds"` } `json:"healthCheck"` Timestamp string `json:"timestamp"` }
type EventAppTerminated ¶
type EventDeploymentFailed ¶
type EventDeploymentInfo ¶
type EventDeploymentInfo struct { EventType string `json:"eventType"` CurrentStep *DeploymentStep `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
type EventDeploymentStepFailure ¶
type EventDeploymentStepFailure struct { EventType string `json:"eventType"` CurrentStep *DeploymentStep `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
type EventDeploymentStepSuccess ¶
type EventDeploymentStepSuccess struct { EventType string `json:"eventType"` CurrentStep *DeploymentStep `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
type EventDeploymentSuccess ¶
type EventFailedHealthCheck ¶
type EventFailedHealthCheck struct { AppId string `json:"appId"` EventType string `json:"eventType"` HealthCheck struct { GracePeriodSeconds float64 `json:"gracePeriodSeconds"` IntervalSeconds float64 `json:"intervalSeconds"` MaxConsecutiveFailures float64 `json:"maxConsecutiveFailures"` Path string `json:"path"` PortIndex float64 `json:"portIndex"` Protocol string `json:"protocol"` TimeoutSeconds float64 `json:"timeoutSeconds"` } `json:"healthCheck"` Timestamp string `json:"timestamp"` }
type EventFrameworkMessage ¶
type EventGroupChangeFailed ¶
type EventGroupChangeSuccess ¶
type EventHealthCheckChanged ¶
type EventRemoveHealthCheck ¶
type EventRemoveHealthCheck struct { AppId string `json:"appId"` EventType string `json:"eventType"` HealthCheck struct { GracePeriodSeconds float64 `json:"gracePeriodSeconds"` IntervalSeconds float64 `json:"intervalSeconds"` MaxConsecutiveFailures float64 `json:"maxConsecutiveFailures"` Path string `json:"path"` PortIndex float64 `json:"portIndex"` Protocol string `json:"protocol"` TimeoutSeconds float64 `json:"timeoutSeconds"` } `json:"healthCheck"` Timestamp string `json:"timestamp"` }
type EventStatusUpdate ¶
type EventStatusUpdate struct { EventType string `json:"eventType"` Timestamp string `json:"timestamp,omitempty"` SlaveID string `json:"slaveId,omitempty"` TaskID string `json:"taskId"` TaskStatus string `json:"taskStatus"` AppID string `json:"appId"` Host string `json:"host"` Ports []int `json:"ports,omitempty"` Version string `json:"version,omitempty"` }
type EventSubscription ¶
type EventUnsubscription ¶
type EventsChannel ¶
type EventsChannel chan *Event
type Group ¶
type Group struct { ID string `json:"id"` Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` }
func (*Group) App ¶
func (group *Group) App(application *Application) *Group
Add a application to the group in question
application: a pointer to the Application
type Groups ¶
type Groups struct { ID string `json:"id"` Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` }
type HealthCheck ¶
type HealthCheck struct { Command *Command `json:"command,omitempty"` Protocol string `json:"protocol,omitempty"` Path string `json:"path,omitempty"` GracePeriodSeconds int `json:"gracePeriodSeconds,omitempty"` IntervalSeconds int `json:"intervalSeconds,omitempty"` PortIndex int `json:"portIndex,omitempty"` MaxConsecutiveFailures int `json:"maxConsecutiveFailures,omitempty"` TimeoutSeconds int `json:"timeoutSeconds,omitempty"` }
func NewDefaultHealthCheck ¶
func NewDefaultHealthCheck() *HealthCheck
type HealthCheckResult ¶
type Info ¶
type Info struct { EventSubscriber struct { HttpEndpoints []string `json:"http_endpoints"` Type string `json:"type"` } `json:"event_subscriber"` FrameworkId string `json:"frameworkId"` HttpConfig struct { AssetsPath interface{} `json:"assets_path"` HttpPort float64 `json:"http_port"` HttpsPort float64 `json:"https_port"` } `json:"http_config"` Leader string `json:"leader"` MarathonConfig struct { Checkpoint bool `json:"checkpoint"` Executor string `json:"executor"` FailoverTimeout float64 `json:"failover_timeout"` Ha bool `json:"ha"` Hostname string `json:"hostname"` LocalPortMax float64 `json:"local_port_max"` LocalPortMin float64 `json:"local_port_min"` Master string `json:"master"` MesosRole string `json:"mesos_role"` MesosUser string `json:"mesos_user"` ReconciliationInitialDelay float64 `json:"reconciliation_initial_delay"` ReconciliationInterval float64 `json:"reconciliation_interval"` TaskLaunchTimeout float64 `json:"task_launch_timeout"` } `json:"marathon_config"` Name string `json:"name"` Version string `json:"version"` ZookeeperConfig struct { Zk string `json:"zk"` ZkFutureTimeout struct { Duration float64 `json:"duration"` } `json:"zk_future_timeout"` ZkHosts string `json:"zk_hosts"` ZkPath string `json:"zk_path"` ZkState string `json:"zk_state"` ZkTimeout float64 `json:"zk_timeout"` } `json:"zookeeper_config"` }
type LastTaskFailure ¶
type LastTaskFailure struct { AppId string `json:"appId,omitempty"` Host string `json:"host,omitempty"` Message string `json:"message,omitempty"` State string `json:"state,omitempty"` TaskId string `json:"taskId,omitempty"` Timestamp string `json:"timestamp,omitempty"` Version string `json:"version,omitempty"` }
type Marathon ¶
type Marathon interface { /* check it see if a application exists */ HasApplication(name string) (bool, error) /* get a listing of the application ids */ ListApplications(url.Values) ([]string, error) /* a list of application versions */ ApplicationVersions(name string) (*ApplicationVersions, error) /* check a application version exists */ HasApplicationVersion(name, version string) (bool, error) /* change an application to a different version */ SetApplicationVersion(name string, version *ApplicationVersion) (*DeploymentID, error) /* check if an application is ok */ ApplicationOK(name string) (bool, error) /* create an application in marathon */ CreateApplication(application *Application, wait_on_running bool) (*Application, error) /* delete an application */ DeleteApplication(name string) (*DeploymentID, error) /* update an application in marathon */ UpdateApplication(application *Application, wait_on_running bool) (*Application, error) /* a list of deployments on a application */ ApplicationDeployments(name string) ([]*DeploymentID, error) /* scale a application */ ScaleApplicationInstances(name string, instances int, force bool) (*DeploymentID, error) /* restart an application */ RestartApplication(name string, force bool) (*DeploymentID, error) /* get a list of applications from marathon */ Applications(url.Values) (*Applications, error) /* get a specific application */ Application(name string) (*Application, error) /* wait of application */ WaitOnApplication(name string, timeout time.Duration) error /* get a list of tasks for a specific application */ Tasks(application string) (*Tasks, error) /* get a list of all tasks */ AllTasks() (*Tasks, error) /* get a listing of the task ids */ ListTasks() ([]string, error) /* get the endpoints for a service on a application */ TaskEndpoints(name string, port int, health_check bool) ([]string, error) /* kill all the tasks for any application */ KillApplicationTasks(application_id, hostname string, scale bool) (*Tasks, error) /* kill a single task */ KillTask(task_id string, scale bool) (*Task, error) /* kill the given array of tasks */ KillTasks(task_ids []string, scale bool) error /* list all the groups in the system */ Groups() (*Groups, error) /* retrieve a specific group from marathon */ Group(name string) (*Group, error) /* create a group deployment */ CreateGroup(group *Group, wait_on_running bool) error /* delete a group */ DeleteGroup(name string) (*DeploymentID, error) /* update a groups */ UpdateGroup(id string, group *Group) (*DeploymentID, error) /* check if a group exists */ HasGroup(name string) (bool, error) /* wait for an group to be deployed */ WaitOnGroup(name string, timeout time.Duration) error /* get a list of the deployments */ Deployments() ([]*Deployment, error) /* delete a deployment */ DeleteDeployment(id string, force bool) (*DeploymentID, error) /* check to see if a deployment exists */ HasDeployment(id string) (bool, error) /* wait of a deployment to finish */ WaitOnDeployment(version string, timeout time.Duration) error /* a list of current subscriptions */ Subscriptions() (*Subscriptions, error) /* add a events listener */ AddEventsListener(channel EventsChannel, filter int) error /* remove a events listener */ RemoveEventsListener(channel EventsChannel) /* remove our self from subscriptions */ UnSubscribe() error /* get the marathon url */ GetMarathonURL() string /* ping the marathon */ Ping() (bool, error) /* grab the marathon server info */ Info() (*Info, error) /* retrieve the leader info */ Leader() (string, error) /* cause the current leader to abdicate */ AbdicateLeader() (string, error) }
type MarathonCluster ¶
func (*MarathonCluster) Active ¶
func (cluster *MarathonCluster) Active() []string
Retrieve a list of active members
func (*MarathonCluster) ClusterState ¶
func (cluster *MarathonCluster) ClusterState() []string
func (*MarathonCluster) GetMarathonURL ¶
func (cluster *MarathonCluster) GetMarathonURL(member *Member) string
Retrieves the current marathon url
func (*MarathonCluster) GetMember ¶
func (cluster *MarathonCluster) GetMember() (string, error)
Retrieve the current member, i.e. the current endpoint in use
func (*MarathonCluster) MarkDown ¶
func (cluster *MarathonCluster) MarkDown()
Marks the current endpoint as down and waits for it to come back only
func (*MarathonCluster) NonActive ¶
func (cluster *MarathonCluster) NonActive() []string
Retrieve a list of endpoints which are non-active
func (*MarathonCluster) Size ¶
func (cluster *MarathonCluster) Size() int
Retrieve the size of the cluster
func (MarathonCluster) String ¶
func (cluster MarathonCluster) String() string
func (*MarathonCluster) Url ¶
func (cluster *MarathonCluster) Url() string
type Parameters ¶
type PortMapping ¶
type Subscriptions ¶
type Subscriptions struct {
CallbackURLs []string `json:"callbackUrls"`
}
type Task ¶
type Task struct { ID string `json:"id"` AppID string `json:"appId"` Host string `json:"host"` HealthCheckResult []*HealthCheckResult `json:"healthCheckResults"` Ports []int `json:"ports"` ServicePorts []int `json:"servicePorts"` StagedAt string `json:"stagedAt"` StartedAt string `json:"startedAt"` Version string `json:"version"` }
func (*Task) HasHealthCheckResults ¶
Check if the task has any health checks