Documentation
¶
Overview ¶
Marathon API
Index ¶
- Constants
- Variables
- type AppById
- type AppKillTasksOptions
- type AppOrGroup
- type AppRestartOptions
- type Application
- type Applications
- type Container
- type CreateOptions
- type Deploy
- type DeploymentID
- type DeploymentPlan
- type Deploys
- type Discovery
- type DiscoveryPorts
- type Docker
- 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 EventStreamAttached
- type EventStreamDetached
- type EventStreamState
- type EventSubscription
- type EventType
- type EventUnHealthyTaskKilled
- type EventUnsubscription
- type EventsChannel
- type ExternalVolume
- type Fetch
- type Group
- type Groups
- type HealthCheck
- type HealthCheckResult
- type IPAddress
- type KillTasksScale
- type LastTaskFailure
- type LeaderInfo
- type Marathon
- type MarathonClient
- func (c *MarathonClient) AbdicateLeader() (*Message, error)
- func (c *MarathonClient) CancelAppDeployment(appId string, matchPrefix bool) (*DeploymentID, error)
- func (c *MarathonClient) CloseEventStreamListener(channel EventsChannel)
- func (c *MarathonClient) CreateApplication(app *Application, wait, force bool) (*Application, error)
- func (c *MarathonClient) CreateApplicationFromFile(filename string, opts *CreateOptions) (*Application, error)
- func (c *MarathonClient) CreateApplicationFromString(filename string, appstr string, opts *CreateOptions) (*Application, error)
- func (c *MarathonClient) CreateEventStreamListener(channel EventsChannel, filter int) error
- func (c *MarathonClient) CreateGroup(group *Group, wait, force bool) (*Group, error)
- func (c *MarathonClient) CreateGroupFromFile(filename string, opts *CreateOptions) (*Group, error)
- func (c *MarathonClient) CreateGroupFromString(filename string, grpstr string, opts *CreateOptions) (*Group, error)
- func (c *MarathonClient) DeleteDeployment(id string, force bool) (*DeploymentID, error)
- func (c *MarathonClient) DestroyApplication(id string) (*DeploymentID, error)
- func (c *MarathonClient) DestroyGroup(id string) (*DeploymentID, error)
- func (c *MarathonClient) GetApplication(id string) (*Application, error)
- func (c *MarathonClient) GetCurrentLeader() (*LeaderInfo, error)
- func (c *MarathonClient) GetEvent(eventType string) (*Event, error)
- func (c *MarathonClient) GetGroup(id string) (*Group, error)
- func (c *MarathonClient) GetMarathonInfo() (*MarathonInfo, error)
- func (c *MarathonClient) GetTasks(id string) ([]*Task, error)
- func (c *MarathonClient) HasApplication(id string) (bool, error)
- func (c *MarathonClient) HasDeployment(id string) (bool, error)
- func (c *MarathonClient) KillAppTask(taskId string, scale bool) (*Task, error)
- func (c *MarathonClient) KillAppTasks(id string, host string, scale bool) ([]*Task, error)
- func (c *MarathonClient) KillTasksAndScale(ids ...string) error
- func (c *MarathonClient) ListApplications() (*Applications, error)
- func (c *MarathonClient) ListApplicationsWithFilters(filter string) (*Applications, error)
- func (c *MarathonClient) ListDeployments() ([]*Deploy, error)
- func (c *MarathonClient) ListGroups() (*Groups, error)
- func (c *MarathonClient) ListQueue() (*Queue, error)
- func (c *MarathonClient) ListTasks() ([]*Task, error)
- func (c *MarathonClient) ListVersions(id string) (*Versions, error)
- func (c *MarathonClient) ParseApplicationFromFile(filename string, opts *CreateOptions) (*Application, error)
- func (c *MarathonClient) ParseApplicationFromString(r io.Reader, et encoding.EncoderType, opts *CreateOptions) (*Application, error)
- func (c *MarathonClient) ParseGroupFromFile(filename string, opts *CreateOptions) (*Group, error)
- func (c *MarathonClient) ParseGroupFromString(r io.Reader, et encoding.EncoderType, opts *CreateOptions) (*Group, error)
- func (c *MarathonClient) PauseApplication(id string) (*DeploymentID, error)
- func (c *MarathonClient) Ping() (*MarathonPing, error)
- func (c *MarathonClient) RestartApplication(id string, force bool) (*DeploymentID, error)
- func (c *MarathonClient) ScaleApplication(id string, instances int) (*DeploymentID, error)
- func (c *MarathonClient) UpdateApplication(app *Application, wait bool, force bool) (*Application, error)
- func (c *MarathonClient) UpdateGroup(group *Group, wait bool) (*Group, error)
- func (c *MarathonClient) WaitForApplication(id string, timeout time.Duration) error
- func (c *MarathonClient) WaitForApplicationHealthy(id string, timeout time.Duration) error
- func (c *MarathonClient) WaitForDeployment(id string, timeout time.Duration) error
- type MarathonHAClient
- type MarathonInfo
- type MarathonOptions
- type MarathonPing
- type Message
- type Parameters
- type PersistentVolume
- type PortMapping
- type Queue
- type QueuedTask
- type ReadinessCheck
- type Residency
- type Step
- type StepActions
- type Task
- type TaskIPAddress
- type Tasks
- type UpgradeStrategy
- type VersionInfo
- type Versions
- type Volume
- type Which
Constants ¶
const ( ActionRestart = "restart" ActionVersions = "versions" PathTasks = "tasks" )
const ( // EventIDAPIRequest is the event listener ID for the corresponding event. EventIDAPIRequest = 1 << iota // EventIDStatusUpdate is the event listener ID for the corresponding event. EventIDStatusUpdate // EventIDFrameworkMessage is the event listener ID for the corresponding event. EventIDFrameworkMessage // EventIDSubscription is the event listener ID for the corresponding event. EventIDSubscription // EventIDUnsubscribed is the event listener ID for the corresponding event. EventIDUnsubscribed // EventIDStreamAttached is the event listener ID for the corresponding event. EventIDStreamAttached // EventIDStreamDetached is the event listener ID for the corresponding event. EventIDStreamDetached // EventIDAddHealthCheck is the event listener ID for the corresponding event. EventIDAddHealthCheck // EventIDRemoveHealthCheck is the event listener ID for the corresponding event. EventIDRemoveHealthCheck // EventIDFailedHealthCheck is the event listener ID for the corresponding event. EventIDFailedHealthCheck // EventIDChangedHealthCheck is the event listener ID for the corresponding event. EventIDChangedHealthCheck // EventIDGroupChangeSuccess is the event listener ID for the corresponding event. EventIDGroupChangeSuccess // EventIDGroupChangeFailed is the event listener ID for the corresponding event. EventIDGroupChangeFailed // EventIDDeploymentSuccess is the event listener ID for the corresponding event. EventIDDeploymentSuccess // EventIDDeploymentFailed is the event listener ID for the corresponding event. EventIDDeploymentFailed // EventIDDeploymentInfo is the event listener ID for the corresponding event. EventIDDeploymentInfo // EventIDDeploymentStepSuccess is the event listener ID for the corresponding event. EventIDDeploymentStepSuccess // EventIDDeploymentStepFailed is the event listener ID for the corresponding event. EventIDDeploymentStepFailed // EventIDAppTerminated is the event listener ID for the corresponding event. EventIDAppTerminated // EventIDUnHealthyTaskKilled EventIDUnHealthyTaskKilled // EventIIDDeployment is comprised of all deployment relayed events EventIDDeployments = EventIDDeploymentSuccess | EventIDDeploymentFailed | EventIDDeploymentInfo | EventIDDeploymentStepSuccess | EventIDDeploymentStepFailed //EventIDApplications comprises all listener IDs for application events. EventIDApplications = EventIDStatusUpdate | EventIDChangedHealthCheck | EventIDFailedHealthCheck | EventIDAppTerminated //EventIDSubscriptions comprises all listener IDs for subscription events. EventIDSubscriptions = EventIDSubscription | EventIDUnsubscribed | EventIDStreamAttached | EventIDStreamDetached )
const ( DEFAULT_EVENTS_URL = "event" /* --- api related constants --- */ API_VERSION = "v2" API_APPS = API_VERSION + "/apps" API_TASKS = API_VERSION + "/tasks" API_TASKS_DELETE = API_VERSION + "/tasks/delete" API_DEPLOYMENTS = API_VERSION + "/deployments" API_GROUPS = API_VERSION + "/groups" API_QUEUE = API_VERSION + "/queue" API_INFO = API_VERSION + "/info" API_LEADER = API_VERSION + "/leader" API_EVENTS = API_VERSION + "/events" API_PING = "ping" DefaultTimeout = time.Duration(90) * time.Second )
Variables ¶
var ( ErrorAppExists = errors.New("The application already exists") ErrorGroupExists = errors.New("The group already exists") ErrorInvalidGroupId = errors.New("The group identifier is invalid") ErrorNoAppExists = errors.New("The application does not exist. Create an application before updating") ErrorGroupAppExists = errors.New("The group does not exist. Create a group before updating") ErrorAppParamsMissing = errors.New("One or more ${PARAMS} that were defined in the app configuration could not be resolved.") )
var ( ErrorTimeout = errors.New("The operation has timed out") ErrorDeploymentNotfound = errors.New("Failed to get deployment in allocated time") )
Functions ¶
This section is empty.
Types ¶
type AppById ¶
type AppById struct {
App Application `json:"app"`
}
type AppKillTasksOptions ¶
type AppOrGroup ¶ added in v0.8.9
type AppOrGroup struct { ID string `json:"id"` Apps []*Application `json:"apps,omitempty"` Groups []*Group `json:"groups,omitempty"` }
func (*AppOrGroup) IsApplication ¶ added in v0.8.9
func (ag *AppOrGroup) IsApplication() bool
type AppRestartOptions ¶
type AppRestartOptions struct {
Force bool `json:"force"`
}
type Application ¶
type Application struct { ID string `json:"id,omitempty"` Cmd string `json:"cmd,omitempty"` Args []string `json:"args,omitempty"` AcceptedResourceRoles []string `json:"acceptedResourceRoles,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"` Labels map[string]string `json:"labels,omitempty"` Executor string `json:"executor,omitempty"` HealthChecks []*HealthCheck `json:"healthChecks,omitempty"` ReadinessChecks []*ReadinessCheck `json:"readinessChecks,omitempty"` Instances int `json:"instances,omitempty"` Mem float64 `json:"mem,omitempty"` Tasks []*Task `json:"tasks,omitempty"` Ports []int `json:"ports,omitempty"` ServicePorts []int `json:"servicePorts,omitempty"` RequirePorts bool `json:"requirePorts,omitempty"` BackoffFactor float64 `json:"backoffFactor,omitempty"` BackoffSeconds int `json:"backoffSeconds,omitempty"` DeploymentID []map[string]string `json:"deployments,omitempty"` Dependencies []string `json:"dependencies,omitempty"` TasksRunning int `json:"tasksRunning,omitempty"` TasksStaged int `json:"tasksStaged,omitempty"` TasksHealthy int `json:"tasksHealthy,omitempty"` TasksUnHealthy int `json:"tasksUnHealthy,omitempty"` TaskIPAddress *TaskIPAddress `json:"ipAddress,omitempty"` User string `json:"user,omitempty"` UpgradeStrategy *UpgradeStrategy `json:"upgradeStrategy,omitempty"` Uris []string `json:"uris,omitempty"` Version string `json:"version,omitempty"` VersionInfo *VersionInfo `json:"versionInfo,omitempty"` LastTaskFailure *LastTaskFailure `json:"lastTaskFailure,omitempty"` Fetch []Fetch `json:"fetch"` Residency *Residency `json:"residency,omitempty"` StoreURLs []string `json:"storeUrls,omitempty"` }
func NewApplication ¶
func NewApplication(id string) *Application
func (*Application) CPU ¶
func (app *Application) CPU(cpu float64) *Application
The amount of CPU shares to assign per instance {cpu} - the CPU shares
func (*Application) Count ¶
func (app *Application) Count(count int) *Application
The number of instances that the application should run {count} - number of instances
func (*Application) Memory ¶
func (app *Application) Memory(memory float64) *Application
The amount of memory in MB to assign per instance {memory} - memory in MB
func (*Application) RollbackVersion ¶
func (app *Application) RollbackVersion(version string) *Application
Rolls back an application to a specific version {version} - the version to rollback
type Applications ¶
type Applications struct {
Apps []Application `json:"apps"`
}
type CreateOptions ¶
type CreateOptions struct { // if true will attempt to wait until the new application or group is running Wait bool // if true and an application/group already exists an update will be performed. // if false and an application/group exists an error will be returned Force bool // If true an error will be returned on params defined in the configuration file that // could not resolve to user input and environment variables ErrorOnMissingParams bool // Additional environment params - looks at this map for token substitution which takes // priority over matching environment variables EnvParams map[string]string // If an existing deployment for this group/app is in progress then remove it and let this revision // take its place StopDeploy bool TemplateMap map[string]string // Do not actually create - output final parsed payload which would be POSTED and then exit DryRun bool }
type DeploymentID ¶
type DeploymentPlan ¶ added in v0.9.2
type Discovery ¶ added in v0.8.6
type Discovery struct {
Ports []*DiscoveryPorts `json:"ports,omitempty"`
}
type DiscoveryPorts ¶ added in v0.8.6
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"` }
type EventAPIRequest ¶ added in v0.9.2
type EventAPIRequest struct { EventType string `json:"eventType"` ClientIP string `json:"clientIp"` Timestamp string `json:"timestamp"` URI string `json:"uri"` AppDefinition *Application `json:"appDefinition"` }
EventAPIRequest describes an 'api_post_event' event.
type EventAddHealthCheck ¶ added in v0.9.2
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"` }
EventAddHealthCheck describes an 'add_health_check_event' event.
type EventAppTerminated ¶ added in v0.9.2
type EventAppTerminated struct { EventType string `json:"eventType"` Timestamp string `json:"timestamp,omitempty"` AppID string `json:"appId"` }
EventAppTerminated describes an 'app_terminated_event' event.
type EventDeploymentFailed ¶ added in v0.9.2
type EventDeploymentFailed struct { ID string `json:"id"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventDeploymentFailed describes a 'deployment_failed' event.
type EventDeploymentInfo ¶ added in v0.9.2
type EventDeploymentInfo struct { EventType string `json:"eventType"` CurrentStep *StepActions `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
EventDeploymentInfo describes a 'deployment_info' event.
type EventDeploymentStepFailure ¶ added in v0.9.2
type EventDeploymentStepFailure struct { EventType string `json:"eventType"` CurrentStep *StepActions `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
EventDeploymentStepFailure describes a 'deployment_step_failure' event.
type EventDeploymentStepSuccess ¶ added in v0.9.2
type EventDeploymentStepSuccess struct { EventType string `json:"eventType"` CurrentStep *StepActions `json:"currentStep"` Timestamp string `json:"timestamp"` Plan *DeploymentPlan `json:"plan"` }
EventDeploymentStepSuccess describes a 'deployment_step_success' event.
type EventDeploymentSuccess ¶ added in v0.9.2
type EventDeploymentSuccess struct { ID string `json:"id"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventDeploymentSuccess describes a 'deployment_success' event.
type EventFailedHealthCheck ¶ added in v0.9.2
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"` }
EventFailedHealthCheck describes a 'failed_health_check_event' event.
type EventFrameworkMessage ¶ added in v0.9.2
type EventFrameworkMessage struct { EventType string `json:"eventType"` ExecutorID string `json:"executorId"` Message string `json:"message"` SlaveID string `json:"slaveId"` Timestamp string `json:"timestamp"` }
EventFrameworkMessage describes a 'framework_message_event' event.
type EventGroupChangeFailed ¶ added in v0.9.2
type EventGroupChangeFailed struct { EventType string `json:"eventType"` GroupID string `json:"groupId"` Timestamp string `json:"timestamp"` Version string `json:"version"` Reason string `json:"reason"` }
EventGroupChangeFailed describes a 'group_change_failed' event.
type EventGroupChangeSuccess ¶ added in v0.9.2
type EventGroupChangeSuccess struct { EventType string `json:"eventType"` GroupID string `json:"groupId"` Timestamp string `json:"timestamp"` Version string `json:"version"` }
EventGroupChangeSuccess describes a 'group_change_success' event.
type EventHealthCheckChanged ¶ added in v0.9.2
type EventHealthCheckChanged struct { EventType string `json:"eventType"` Timestamp string `json:"timestamp,omitempty"` AppID string `json:"appId"` TaskID string `json:"taskId"` Version string `json:"version,omitempty"` Alive bool `json:"alive"` }
EventHealthCheckChanged describes a 'health_status_changed_event' event.
type EventRemoveHealthCheck ¶ added in v0.9.2
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"` }
EventRemoveHealthCheck describes a 'remove_health_check_event' event.
type EventStatusUpdate ¶ added in v0.9.2
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"` Message string `json:"message,omitempty"` AppID string `json:"appId"` Host string `json:"host"` Ports []int `json:"ports,omitempty"` IPAddresses []*IPAddress `json:"ipAddresses"` Version string `json:"version,omitempty"` }
EventStatusUpdate describes a 'status_update_event' event.
type EventStreamAttached ¶ added in v0.9.2
type EventStreamAttached struct { RemoteAddress string `json:"remoteAddress"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventStreamAttached describes an 'event_stream_attached' event.
type EventStreamDetached ¶ added in v0.9.2
type EventStreamDetached struct { RemoteAddress string `json:"remoteAddress"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventStreamDetached describes an 'event_stream_detached' event.
type EventStreamState ¶ added in v0.9.2
type EventStreamState struct {
// contains filtered or unexported fields
}
type EventSubscription ¶ added in v0.9.2
type EventSubscription struct { CallbackURL string `json:"callbackUrl"` ClientIP string `json:"clientIp"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventSubscription describes a 'subscribe_event' event.
type EventType ¶ added in v0.9.2
type EventType struct {
EventType string `json:"eventType"`
}
EventType is a wrapper for a marathon event
type EventUnHealthyTaskKilled ¶ added in v0.9.3
type EventUnHealthyTaskKilled struct { EventType string `json:"eventType"` Timestamp string `json:"timestamp,omitempty"` AppID string `json:"appId"` TaskID string `json:"taskId"` Version string `json:"version,omitempty"` Host string `json:"host"` Reason string `json:"reason"` }
EventHealthCheckChanged describes a 'unhealthy_task_kill_event' event.
type EventUnsubscription ¶ added in v0.9.2
type EventUnsubscription struct { CallbackURL string `json:"callbackUrl"` ClientIP string `json:"clientIp"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventUnsubscription describes an 'unsubscribe_event' event.
type EventsChannel ¶ added in v0.9.2
type EventsChannel chan *Event
EventsChannel is a channel to receive events upon
type ExternalVolume ¶ added in v0.8.6
type Group ¶
type Group struct { GroupID string `json:"id"` Version string `json:"version,omitempty"` Apps []*Application `json:"apps,omitempty"` Dependencies []string `json:"dependencies,omitempty"` Groups []*Group `json:"groups,omitempty"` }
type Groups ¶
type Groups struct { GroupID string `json:"id"` Version string `json:"version"` Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` }
type HealthCheck ¶
type HealthCheck struct { 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"` }
type HealthCheckResult ¶
type KillTasksScale ¶ added in v0.8.3
type KillTasksScale struct {
IDs []string `json:"ids"`
}
type LastTaskFailure ¶ added in v0.8.6
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 LeaderInfo ¶
type LeaderInfo struct {
Leader string `json:"leader"`
}
type Marathon ¶
type Marathon interface { // Creates a new Application from a file and replaces the tokenized variables // with resolved environment values // // {filename} - the application file of type [ json | yaml ] // {opts} - create application options CreateApplicationFromFile(filename string, opts *CreateOptions) (*Application, error) // Creates a new Application from a file and replaces the tokenized variables // with the resolved environment values // // {filename} - the original filename used to determine the format // {appstr} - the application in yml or json form // {opts} - the create application options CreateApplicationFromString(filename string, appstr string, opts *CreateOptions) (*Application, error) // Creates a new Application // {app} - the application structure containing configuration // {wait} - if true will attempt to wait until the new application is running // {force} - if true and a application already exists an update will be performed. // - if false and a application exists an error will be returned CreateApplication(app *Application, wait, force bool) (*Application, error) // Responsible for parsing an application [ json | yaml ] and susbstituting variables. // This method is called as part of the CreateApplicationFromFile method. ParseApplicationFromFile(filename string, opts *CreateOptions) (*Application, error) // Updates an Application // {app} - the application structure containing configuration // {wait} - if true will attempt to wait until the application updated is running // {force} - if true and a application already exists an update will be performed. UpdateApplication(app *Application, wait, force bool) (*Application, error) // List all applications on a Marathon cluster ListApplications() (*Applications, error) // List all applications on a Marathon cluster with filtering Options ListApplicationsWithFilters(filter string) (*Applications, error) // Get an Application by Id // {id} - application identifier GetApplication(id string) (*Application, error) // Determines if the application exists // {id} - the application identifier HasApplication(id string) (bool, error) // Removes an Application by Id and all of it's running instances // {id} - application identifier DestroyApplication(id string) (*DeploymentID, error) // Restarts an Application // {id} - application identifier // {force} - forces a restart if true RestartApplication(id string, force bool) (*DeploymentID, error) // Scale an Application by Id and Instances // {id} - application identifier // {instances} - instances to scale to ScaleApplication(id string, instances int) (*DeploymentID, error) // Pause an Application by Id // {id} - application identifier PauseApplication(id string) (*DeploymentID, error) // List application versions that have been deployed to Marathon // {id} - the application identifier ListVersions(id string) (*Versions, error) // Attempts to wait for an application to be running // {id} - the application id // {timeout} - the max time to wait WaitForApplication(id string, timeout time.Duration) error // Attempts to wait for an application to be running and healthy (all health checks for all tasks passing) // {id} - the application id // {timeout} - the max time to wait WaitForApplicationHealthy(id string, timeout time.Duration) error // Determines whether a deployment for the specified Id exists // {id} - deployment identifier HasDeployment(id string) (bool, error) // List the current deployments ListDeployments() ([]*Deploy, error) // Deletes a deployment // {id} - deployment identifier // {force} - If set to true, then the deployment is still canceled but no rollback deployment is created. DeleteDeployment(id string, force bool) (*DeploymentID, error) // Cancels an active deployment matching the specified application id (conditional match) // {appId} - the application identifier to match the request on // {matchPrefix} - if true only the prefix will be matched, false the whole id must be matched CancelAppDeployment(appId string, matchPrefix bool) (*DeploymentID, error) // Waits for a deployment to finish for max timeout duration WaitForDeployment(id string, timeout time.Duration) error // Creates a new group from a file and replaces tokenized variables // with resolved environment values // // {filename} - the group file of type [ json | yaml ] // {opts} - create application options CreateGroupFromFile(filename string, opts *CreateOptions) (*Group, error) // Creates a new Group from a string and replaces the tokenized variables // with the resolved environment values // // {filename} - the original filename used to determine the format // {grpstr} - the group in yml or json form // {opts} - the create application options CreateGroupFromString(filename string, grpstr string, opts *CreateOptions) (*Group, error) // Creates a new Group // {group} - the group structure containing configuration // {wait} - if true will attempt to wait until the new group is running // {force} - if true and a group already exists an update will be performed. // - if false and a group exists an error will be returned CreateGroup(group *Group, wait, force bool) (*Group, error) // List all groups ListGroups() (*Groups, error) // Get a Group by Id // {id} - group identifier GetGroup(id string) (*Group, error) // Removes a Group by Id and all of it's related resources (application instances) // {id} - group identifier DestroyGroup(id string) (*DeploymentID, error) // List all running tasks ListTasks() ([]*Task, error) // List all tasks for an application // {id} - the application identifier GetTasks(id string) ([]*Task, error) // Kills application tasks for the app identifier // {id} - the application identifier // {host} - host to kill tasks on or empty (default) // {scale} - Scale the app down (i.e. decrement its instances setting by the number of tasks killed), false is default KillAppTasks(id string, host string, scale bool) ([]*Task, error) // Kill the task with ID taskId that belongs to an application // {taskId} - the task id // {scale} - Scale the app down (ie. decrement it's instances setting by the number of tasks killed). Default: false KillAppTask(taskId string, scale bool) (*Task, error) // Kill the specified task IDs and scale // {ids} - one or more task identifiers to kill and scale KillTasksAndScale(ids ...string) error // List Queue - tasks currently pending ListQueue() (*Queue, error) // Creates an event stream listener which will filter based on the specified // filter mask CreateEventStreamListener(channel EventsChannel, filter int) error // Removes the channel from the event stream listener CloseEventStreamListener(channel EventsChannel) // Pings the Marathon host via the /ping endpoint Ping() (*MarathonPing, error) // Get info about the Marathon Instance GetMarathonInfo() (*MarathonInfo, error) // Get the current Marathon leader GetCurrentLeader() (*LeaderInfo, error) // Abdicates the current leader AbdicateLeader() (*Message, error) }
func NewHAMarathonClientWithOpts ¶ added in v0.9.3
func NewHAMarathonClientWithOpts(username, password, token string, opts *MarathonOptions, hosts ...string) Marathon
NewHAMarathonClientWithOpts creates a new Marathon client setup for HA mode. All the specified hosts will be healthchecked and healthy ones will be returned when this library requests a host
func NewMarathonClient ¶
func NewMarathonClientWithOpts ¶
func NewMarathonClientWithOpts(host, username, password, token string, opts *MarathonOptions) Marathon
type MarathonClient ¶
func (*MarathonClient) AbdicateLeader ¶
func (c *MarathonClient) AbdicateLeader() (*Message, error)
func (*MarathonClient) CancelAppDeployment ¶ added in v0.8.9
func (c *MarathonClient) CancelAppDeployment(appId string, matchPrefix bool) (*DeploymentID, error)
func (*MarathonClient) CloseEventStreamListener ¶ added in v0.9.2
func (c *MarathonClient) CloseEventStreamListener(channel EventsChannel)
func (*MarathonClient) CreateApplication ¶
func (c *MarathonClient) CreateApplication(app *Application, wait, force bool) (*Application, error)
func (*MarathonClient) CreateApplicationFromFile ¶
func (c *MarathonClient) CreateApplicationFromFile(filename string, opts *CreateOptions) (*Application, error)
func (*MarathonClient) CreateApplicationFromString ¶ added in v0.8.9
func (c *MarathonClient) CreateApplicationFromString(filename string, appstr string, opts *CreateOptions) (*Application, error)
func (*MarathonClient) CreateEventStreamListener ¶ added in v0.9.2
func (c *MarathonClient) CreateEventStreamListener(channel EventsChannel, filter int) error
func (*MarathonClient) CreateGroup ¶
func (c *MarathonClient) CreateGroup(group *Group, wait, force bool) (*Group, error)
func (*MarathonClient) CreateGroupFromFile ¶
func (c *MarathonClient) CreateGroupFromFile(filename string, opts *CreateOptions) (*Group, error)
func (*MarathonClient) CreateGroupFromString ¶ added in v0.8.9
func (c *MarathonClient) CreateGroupFromString(filename string, grpstr string, opts *CreateOptions) (*Group, error)
func (*MarathonClient) DeleteDeployment ¶
func (c *MarathonClient) DeleteDeployment(id string, force bool) (*DeploymentID, error)
func (*MarathonClient) DestroyApplication ¶
func (c *MarathonClient) DestroyApplication(id string) (*DeploymentID, error)
func (*MarathonClient) DestroyGroup ¶
func (c *MarathonClient) DestroyGroup(id string) (*DeploymentID, error)
func (*MarathonClient) GetApplication ¶
func (c *MarathonClient) GetApplication(id string) (*Application, error)
func (*MarathonClient) GetCurrentLeader ¶
func (c *MarathonClient) GetCurrentLeader() (*LeaderInfo, error)
func (*MarathonClient) GetEvent ¶ added in v0.9.2
func (c *MarathonClient) GetEvent(eventType string) (*Event, error)
GetEvent returns allocated empty event object which corresponds to provided event type eventType: the type of Marathon event
func (*MarathonClient) GetMarathonInfo ¶
func (c *MarathonClient) GetMarathonInfo() (*MarathonInfo, error)
func (*MarathonClient) HasApplication ¶
func (c *MarathonClient) HasApplication(id string) (bool, error)
func (*MarathonClient) HasDeployment ¶
func (c *MarathonClient) HasDeployment(id string) (bool, error)
func (*MarathonClient) KillAppTask ¶
func (c *MarathonClient) KillAppTask(taskId string, scale bool) (*Task, error)
func (*MarathonClient) KillAppTasks ¶
func (*MarathonClient) KillTasksAndScale ¶ added in v0.8.3
func (c *MarathonClient) KillTasksAndScale(ids ...string) error
func (*MarathonClient) ListApplications ¶
func (c *MarathonClient) ListApplications() (*Applications, error)
func (*MarathonClient) ListApplicationsWithFilters ¶ added in v0.8.9
func (c *MarathonClient) ListApplicationsWithFilters(filter string) (*Applications, error)
func (*MarathonClient) ListDeployments ¶
func (c *MarathonClient) ListDeployments() ([]*Deploy, error)
func (*MarathonClient) ListGroups ¶
func (c *MarathonClient) ListGroups() (*Groups, error)
func (*MarathonClient) ListQueue ¶
func (c *MarathonClient) ListQueue() (*Queue, error)
func (*MarathonClient) ListTasks ¶
func (c *MarathonClient) ListTasks() ([]*Task, error)
func (*MarathonClient) ListVersions ¶
func (c *MarathonClient) ListVersions(id string) (*Versions, error)
func (*MarathonClient) ParseApplicationFromFile ¶ added in v0.8.3
func (c *MarathonClient) ParseApplicationFromFile(filename string, opts *CreateOptions) (*Application, error)
func (*MarathonClient) ParseApplicationFromString ¶ added in v0.8.9
func (c *MarathonClient) ParseApplicationFromString(r io.Reader, et encoding.EncoderType, opts *CreateOptions) (*Application, error)
func (*MarathonClient) ParseGroupFromFile ¶ added in v0.8.9
func (c *MarathonClient) ParseGroupFromFile(filename string, opts *CreateOptions) (*Group, error)
func (*MarathonClient) ParseGroupFromString ¶ added in v0.8.9
func (c *MarathonClient) ParseGroupFromString(r io.Reader, et encoding.EncoderType, opts *CreateOptions) (*Group, error)
func (*MarathonClient) PauseApplication ¶ added in v0.9.5
func (c *MarathonClient) PauseApplication(id string) (*DeploymentID, error)
func (*MarathonClient) Ping ¶
func (c *MarathonClient) Ping() (*MarathonPing, error)
func (*MarathonClient) RestartApplication ¶
func (c *MarathonClient) RestartApplication(id string, force bool) (*DeploymentID, error)
func (*MarathonClient) ScaleApplication ¶
func (c *MarathonClient) ScaleApplication(id string, instances int) (*DeploymentID, error)
func (*MarathonClient) UpdateApplication ¶
func (c *MarathonClient) UpdateApplication(app *Application, wait bool, force bool) (*Application, error)
func (*MarathonClient) UpdateGroup ¶
func (c *MarathonClient) UpdateGroup(group *Group, wait bool) (*Group, error)
func (*MarathonClient) WaitForApplication ¶
func (c *MarathonClient) WaitForApplication(id string, timeout time.Duration) error
func (*MarathonClient) WaitForApplicationHealthy ¶
func (c *MarathonClient) WaitForApplicationHealthy(id string, timeout time.Duration) error
func (*MarathonClient) WaitForDeployment ¶
func (c *MarathonClient) WaitForDeployment(id string, timeout time.Duration) error
type MarathonHAClient ¶ added in v0.9.3
type MarathonHAClient struct {
*MarathonClient
}
type MarathonInfo ¶
type MarathonInfo 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 MarathonOptions ¶
type MarathonPing ¶
type Parameters ¶
type PersistentVolume ¶ added in v0.8.6
type PersistentVolume struct {
Size int `json:"size,omitempty"`
}
type PortMapping ¶
type Queue ¶
type Queue struct {
Queue []QueuedTask `json:"queue"`
}
type QueuedTask ¶
type QueuedTask struct { App *Application `json:"app"` Delay map[string]bool `json:"delay"` }
type ReadinessCheck ¶ added in v0.8.6
type ReadinessCheck struct { Name string `json:"name,omitempty"` Protocol string `json:"protocol,omitempty"` Path string `json:"path,omitempty"` PortName string `json:"portName,omitempty"` IntervalSeconds int `json:"intervalSeconds,omitempty"` TimeoutSeconds int `json:"timeoutSeconds,omitempty"` HttpStatusCodesReady int `json:"httpStatusCodesForReady,omitempty"` PreserveLastResponse bool `json:"preserveLastResponse,omitempty"` }
type StepActions ¶ added in v0.9.2
type Task ¶
type Task struct { AppID string `json:"appId"` Host string `json:"host"` ID string `json:"id"` HealthCheckResult []*HealthCheckResult `json:"healthCheckResults"` Ports []int `json:"ports"` ServicePorts []int `json:"servicePorts"` StagedAt string `json:"stagedAt"` StartedAt string `json:"startedAt"` Version string `json:"version"` }
type TaskIPAddress ¶ added in v0.8.6
type UpgradeStrategy ¶
type VersionInfo ¶ added in v0.8.6
type Volume ¶
type Volume struct { ContainerPath string `json:"containerPath,omitempty"` HostPath string `json:"hostPath,omitempty"` Mode string `json:"mode,omitempty"` Persistent *PersistentVolume `json:"persistent,omitempty"` External *ExternalVolume `json:"external,omitempty"` }