Documentation ¶
Index ¶
- Constants
- Variables
- func NewAPIError(code int, content []byte) error
- type APIError
- type AllTasksOpts
- type Application
- func (r *Application) AddArgs(arguments ...string) *Application
- func (r *Application) AddConstraint(constraints ...string) *Application
- func (r *Application) AddEnv(name, value string) *Application
- func (r *Application) AddFetchURIs(fetchURIs ...Fetch) *Application
- func (r *Application) AddHealthCheck(healthCheck HealthCheck) *Application
- func (r *Application) AddLabel(name, value string) *Application
- func (r *Application) AddPortDefinition(portDefinition PortDefinition) *Application
- func (r *Application) AddUris(newUris ...string) *Application
- func (r *Application) AllTaskRunning() bool
- func (r *Application) CPU(cpu float64) *Application
- func (r *Application) CheckHTTP(uri string, port, interval int) (*Application, error)
- func (r *Application) CheckTCP(port, interval int) (*Application, error)
- func (r *Application) Command(cmd string) *Application
- func (r *Application) Count(count int) *Application
- func (r *Application) DependsOn(names ...string) *Application
- func (r *Application) DeploymentIDs() []*DeploymentID
- func (r *Application) EmptyArgs() *Application
- func (r *Application) EmptyConstraints() *Application
- func (r *Application) EmptyEnvs() *Application
- func (r *Application) EmptyFetchURIs() *Application
- func (r *Application) EmptyHealthChecks() *Application
- func (r *Application) EmptyLabels() *Application
- func (r *Application) EmptyPortDefinitions() *Application
- func (r *Application) EmptyUris() *Application
- func (r *Application) HasHealthChecks() bool
- func (r *Application) Memory(memory float64) *Application
- func (r *Application) Name(id string) *Application
- func (r *Application) SetExecutor(executor string) *Application
- func (r *Application) SetIPAddressPerTask(ipAddressPerTask IPAddressPerTask) *Application
- func (r *Application) Storage(disk float64) *Application
- func (r *Application) String() string
- type ApplicationVersion
- type ApplicationVersions
- type Applications
- type Command
- type Config
- type Container
- type Delay
- type DeleteAppOpts
- type DeleteGroupOpts
- type Deployment
- type DeploymentID
- type DeploymentPlan
- type DeploymentStep
- type Discovery
- type Docker
- func (docker *Docker) AddParameter(key string, value string) *Docker
- func (docker *Docker) Bridged() *Docker
- func (docker *Docker) Container(image string) *Docker
- func (docker *Docker) EmptyParameters() *Docker
- func (docker *Docker) EmptyPortMappings() *Docker
- func (docker *Docker) Expose(ports ...int) *Docker
- func (docker *Docker) ExposePort(portMapping PortMapping) *Docker
- func (docker *Docker) ExposeUDP(ports ...int) *Docker
- func (docker *Docker) Host() *Docker
- func (docker *Docker) ServicePortIndex(port int) (int, error)
- func (docker *Docker) SetForcePullImage(forcePull bool) *Docker
- func (docker *Docker) SetPrivileged(priv bool) *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 EventSubscription
- type EventType
- type EventUnsubscription
- type EventsChannel
- type EventsChannelContext
- type EventsTransport
- type ExternalVolume
- type Fetch
- type GetAppOpts
- type GetGroupOpts
- type Group
- type Groups
- type HealthCheck
- type HealthCheckResult
- type IPAddress
- type IPAddressPerTask
- func (i *IPAddressPerTask) AddGroup(group string) *IPAddressPerTask
- func (i *IPAddressPerTask) AddLabel(name, value string) *IPAddressPerTask
- func (i *IPAddressPerTask) EmptyGroups() *IPAddressPerTask
- func (i *IPAddressPerTask) EmptyLabels() *IPAddressPerTask
- func (i *IPAddressPerTask) SetDiscovery(discovery Discovery) *IPAddressPerTask
- type Info
- type InvalidEndpointError
- type Item
- type KillApplicationTasksOpts
- type KillTaskOpts
- type LastTaskFailure
- type Marathon
- type Parameters
- type Port
- type PortDefinition
- type PortMapping
- type Queue
- type StepActions
- type Subscriptions
- type Task
- type Tasks
- type UpdateGroupOpts
- type UpgradeStrategy
- type VersionInfo
- type Volume
Examples ¶
Constants ¶
const ( // ErrCodeBadRequest specifies a 400 Bad Request error. ErrCodeBadRequest = iota ErrCodeUnauthorized // ErrCodeForbidden specifies a 403 Forbidden error. ErrCodeForbidden // ErrCodeNotFound specifies a 404 Not Found error. ErrCodeNotFound // ErrCodeDuplicateID specifies a PUT 409 Conflict error. ErrCodeDuplicateID // ErrCodeAppLocked specifies a POST 409 Conflict error. ErrCodeAppLocked // ErrCodeInvalidBean specifies a 422 UnprocessableEntity error. ErrCodeInvalidBean // ErrCodeServer specifies a 500+ Server error. ErrCodeServer // ErrCodeUnknown specifies an unknown error. ErrCodeUnknown )
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 //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 )
Variables ¶
var ( // ErrInvalidResponse is thrown when marathon responds with invalid or error response ErrInvalidResponse = errors.New("invalid response from Marathon") // ErrMarathonDown is thrown when all the marathon endpoints are down ErrMarathonDown = errors.New("all the Marathon hosts are presently down") // ErrTimeoutError is thrown when the operation has timed out ErrTimeoutError = errors.New("the operation has timed out") )
var ( // ErrNoApplicationContainer is thrown when a container has been specified yet ErrNoApplicationContainer = errors.New("you have not specified a docker container yet") )
Functions ¶
func NewAPIError ¶
NewAPIError creates a new APIError instance from the given response code and content.
Types ¶
type APIError ¶
type APIError struct { // ErrCode specifies the nature of the error. ErrCode int // contains filtered or unexported fields }
APIError represents a generic API error.
type AllTasksOpts ¶
type AllTasksOpts struct {
Status string `url:"status,omitempty"`
}
AllTasksOpts contains a payload for AllTasks method
status: Return only those tasks whose status matches this parameter. If not specified, all tasks are returned. Possible values: running, staging. Default: none.
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"` PortDefinitions *[]PortDefinition `json:"portDefinitions,omitempty"` RequirePorts *bool `json:"requirePorts,omitempty"` BackoffSeconds *float64 `json:"backoffSeconds,omitempty"` BackoffFactor *float64 `json:"backoffFactor,omitempty"` MaxLaunchDelaySeconds *float64 `json:"maxLaunchDelaySeconds,omitempty"` Deployments []map[string]string `json:"deployments,omitempty"` Dependencies []string `json:"dependencies"` TasksRunning int `json:"tasksRunning,omitempty"` TasksStaged int `json:"tasksStaged,omitempty"` TasksHealthy int `json:"tasksHealthy,omitempty"` TasksUnhealthy int `json:"tasksUnhealthy,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"` Labels *map[string]string `json:"labels,omitempty"` AcceptedResourceRoles []string `json:"acceptedResourceRoles,omitempty"` LastTaskFailure *LastTaskFailure `json:"lastTaskFailure,omitempty"` Fetch *[]Fetch `json:"fetch,omitempty"` IPAddressPerTask *IPAddressPerTask `json:"ipAddress,omitempty"` }
Application is the definition for an application in marathon
func NewDockerApplication ¶
func NewDockerApplication() *Application
NewDockerApplication creates a default docker application
func (*Application) AddArgs ¶ added in v0.1.0
func (r *Application) AddArgs(arguments ...string) *Application
AddArgs adds one or more arguments to the applications
arguments: the argument(s) you are adding
func (*Application) AddConstraint ¶ added in v0.1.0
func (r *Application) AddConstraint(constraints ...string) *Application
AddConstraint adds a new constraint
constraints: the constraint definition, one constraint per array element
Example ¶
app := NewDockerApplication() // add two constraints app.AddConstraint("hostname", "UNIQUE"). AddConstraint("rack_id", "CLUSTER", "rack-1")
Output:
func (*Application) AddEnv ¶
func (r *Application) AddEnv(name, value string) *Application
AddEnv adds an environment variable to the application
name: the name of the variable value: go figure, the value associated to the above
func (*Application) AddFetchURIs ¶ added in v0.1.0
func (r *Application) AddFetchURIs(fetchURIs ...Fetch) *Application
AddFetchURIs adds one or more fetch URIs to the application.
fetchURIs: the fetch URI(s) to add.
func (*Application) AddHealthCheck ¶ added in v0.1.0
func (r *Application) AddHealthCheck(healthCheck HealthCheck) *Application
AddHealthCheck adds a health check
healthCheck the health check that should be added
func (*Application) AddLabel ¶
func (r *Application) AddLabel(name, value string) *Application
AddLabel adds a label to the application
name: the name of the label value: value for this label
func (*Application) AddPortDefinition ¶ added in v0.2.0
func (r *Application) AddPortDefinition(portDefinition PortDefinition) *Application
AddPortDefinition adds a port definition. Port definitions are used to define ports that should be considered part of a resource. They are necessary when you are using HOST networking and no port mappings are specified.
func (*Application) AddUris ¶ added in v0.1.0
func (r *Application) AddUris(newUris ...string) *Application
AddUris adds one or more uris to the applications
arguments: the uri(s) you are adding
func (*Application) AllTaskRunning ¶
func (r *Application) AllTaskRunning() bool
AllTaskRunning checks to see if all the application tasks are running, i.e. the instances is equal to the number of running tasks
func (*Application) CPU ¶
func (r *Application) CPU(cpu float64) *Application
CPU set 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 (r *Application) CheckHTTP(uri string, port, interval int) (*Application, error)
CheckHTTP adds a 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 (r *Application) CheckTCP(port, interval int) (*Application, error)
CheckTCP adds 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) Command ¶ added in v0.1.0
func (r *Application) Command(cmd string) *Application
Command sets the cmd of the application
func (*Application) Count ¶
func (r *Application) Count(count int) *Application
Count sets the number of instances of the application to run
count: the number of instances to run
func (*Application) DependsOn ¶
func (r *Application) DependsOn(names ...string) *Application
DependsOn adds one or more dependencies 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.
names: the application id(s) this application depends on
func (*Application) DeploymentIDs ¶
func (r *Application) DeploymentIDs() []*DeploymentID
DeploymentIDs retrieves the application deployments IDs
func (*Application) EmptyArgs ¶ added in v0.1.0
func (r *Application) EmptyArgs() *Application
EmptyArgs explicitly empties arguments -- use this if you need to empty arguments of an application that already has arguments set (setting args to nil will keep the current value)
func (*Application) EmptyConstraints ¶ added in v0.1.0
func (r *Application) EmptyConstraints() *Application
EmptyConstraints explicitly empties constraints -- use this if you need to empty constraints of an application that already has constraints set (setting constraints to nil will keep the current value)
func (*Application) EmptyEnvs ¶ added in v0.1.0
func (r *Application) EmptyEnvs() *Application
EmptyEnvs explicitly empties the envs -- use this if you need to empty the environments of an application that already has environments set (setting env to nil will keep the current value)
func (*Application) EmptyFetchURIs ¶ added in v0.1.0
func (r *Application) EmptyFetchURIs() *Application
EmptyFetchURIs explicitly empties fetch URIs -- use this if you need to empty fetch URIs of an application that already has fetch URIs set. Setting fetch URIs to nil will keep the current value.
func (*Application) EmptyHealthChecks ¶ added in v0.1.0
func (r *Application) EmptyHealthChecks() *Application
EmptyHealthChecks explicitly empties health checks -- use this if you need to empty health checks of an application that already has health checks set (setting health checks to nil will keep the current value)
func (*Application) EmptyLabels ¶ added in v0.1.0
func (r *Application) EmptyLabels() *Application
EmptyLabels explicitly empties the labels -- use this if you need to empty the labels of an application that already has labels set (setting labels to nil will keep the current value)
func (*Application) EmptyPortDefinitions ¶ added in v0.2.0
func (r *Application) EmptyPortDefinitions() *Application
EmptyPortDefinitions explicitly empties port definitions -- use this if you need to empty port definitions of an application that already has port definitions set (setting port definitions to nil will keep the current value)
func (*Application) EmptyUris ¶ added in v0.1.0
func (r *Application) EmptyUris() *Application
EmptyUris explicitly empties uris -- use this if you need to empty uris of an application that already has uris set (setting uris to nil will keep the current value)
func (*Application) HasHealthChecks ¶
func (r *Application) HasHealthChecks() bool
HasHealthChecks is a helper method, used to check if an application has health checks
func (*Application) Memory ¶
func (r *Application) Memory(memory float64) *Application
Memory sets he amount of memory the application can consume per instance
memory: the amount of MB to assign
func (*Application) Name ¶
func (r *Application) Name(id string) *Application
Name sets the name / ID of the application i.e. the identifier for this application
func (*Application) SetExecutor ¶ added in v0.1.0
func (r *Application) SetExecutor(executor string) *Application
SetExecutor sets the executor
func (*Application) SetIPAddressPerTask ¶ added in v0.4.0
func (r *Application) SetIPAddressPerTask(ipAddressPerTask IPAddressPerTask) *Application
SetIPAddressPerTask defines that the application will have a IP address defines by a external agent. This configuration is not allowed to be used with Port or PortDefinitions. Thus, the implementation clears both.
func (*Application) Storage ¶
func (r *Application) Storage(disk float64) *Application
Storage sets 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
func (*Application) String ¶ added in v0.1.0
func (r *Application) String() string
String returns the json representation of this application
type ApplicationVersion ¶
type ApplicationVersion struct {
Version string `json:"version"`
}
ApplicationVersion is the application version response from marathon
type ApplicationVersions ¶
type ApplicationVersions struct {
Versions []string `json:"versions"`
}
ApplicationVersions is a collection of application versions for a specific app in marathon
type Applications ¶
type Applications struct {
Apps []Application `json:"apps"`
}
Applications is a collection of applications
type Command ¶
type Command struct {
Value string `json:"value"`
}
Command is the command health check type
type Config ¶
type Config struct { // URL is the url for marathon URL string // EventsTransport is the events transport: EventsTransportCallback or EventsTransportSSE EventsTransport EventsTransport // EventsPort is the event handler port EventsPort int // the interface we should be listening on for events EventsInterface string // HTTPBasicAuthUser is the http basic auth HTTPBasicAuthUser string // HTTPBasicPassword is the http basic password HTTPBasicPassword string // CallbackURL custom callback url CallbackURL string // DCOSToken for DCOS environment, This will override the Authorization header DCOSToken string // LogOutput the output for debug log messages LogOutput io.Writer // HTTPClient is the http client HTTPClient *http.Client // wait time (in milliseconds) between repetitive requests to the API during polling PollingWaitTime time.Duration }
Config holds the settings and options for the client
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig create a default client config
type Container ¶
type Container struct { Type string `json:"type,omitempty"` Docker *Docker `json:"docker,omitempty"` Volumes *[]Volume `json:"volumes,omitempty"` }
Container is the definition for a container type in marathon
func NewDockerContainer ¶
func NewDockerContainer() *Container
NewDockerContainer creates a default docker container for you
func (*Container) EmptyVolumes ¶ added in v0.1.0
EmptyVolumes explicitly empties the volumes -- use this if you need to empty volumes of an application that already has volumes set (setting volumes to nil will keep the current value)
type DeleteAppOpts ¶ added in v0.1.0
type DeleteAppOpts struct {
Force bool `url:"force,omitempty"`
}
DeleteAppOpts contains a payload for DeleteApplication method
force: overrides a currently running deployment.
type DeleteGroupOpts ¶ added in v0.1.0
type DeleteGroupOpts struct {
Force bool `url:"force,omitempty"`
}
DeleteGroupOpts contains a payload for DeleteGroup method
force: overrides a currently running deployment.
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:"-"` XXStepsRaw json.RawMessage `json:"steps"` // Holds raw steps JSON to unmarshal later CurrentActions []*DeploymentStep `json:"currentActions"` }
Deployment is a marathon deployment definition
type DeploymentID ¶
type DeploymentID struct { DeploymentID string `json:"deploymentId"` Version string `json:"version"` }
DeploymentID is the identifier for a application deployment
type DeploymentPlan ¶
type DeploymentPlan struct { ID string `json:"id"` Version string `json:"version"` Original *Group `json:"original"` Target *Group `json:"target"` Steps []*StepActions `json:"steps"` }
DeploymentPlan is a collection of steps for application deployment
type DeploymentStep ¶
DeploymentStep is a step in the application deployment plan
type Discovery ¶ added in v0.4.0
type Discovery struct {
Ports *[]Port `json:"ports,omitempty"`
}
Discovery provides info about ports expose by IP-per-task functionality
func (*Discovery) AddPort ¶ added in v0.4.0
AddPort adds a port to the discovery info of a IP per task applicable
port: The discovery port
func (*Discovery) EmptyPorts ¶ added in v0.4.0
EmptyPorts explicitly empties discovey port -- use this if you need to empty discovey port of an application that already has IP per task with discovey ports defined
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"` }
Docker is the docker definition from a marathon application
func (*Docker) AddParameter ¶ added in v0.1.0
AddParameter adds a parameter to the docker execution line when creating the container
key: the name of the option to add value: the value of the option
func (*Docker) Container ¶
Container sets the image of the container
image: the image name you are using
func (*Docker) EmptyParameters ¶ added in v0.1.0
EmptyParameters explicitly empties the parameters -- use this if you need to empty parameters of an application that already has parameters set (setting parameters to nil will keep the current value)
func (*Docker) EmptyPortMappings ¶ added in v0.1.0
EmptyPortMappings explicitly empties the port mappings -- use this if you need to empty port mappings of an application that already has port mappings set (setting port mappings to nil will keep the current value)
func (*Docker) Expose ¶
Expose sets the container to expose the following TCP ports
ports: the TCP ports the container is exposing
func (*Docker) ExposePort ¶
func (docker *Docker) ExposePort(portMapping PortMapping) *Docker
ExposePort exposes an port in the container
func (*Docker) ExposeUDP ¶
ExposeUDP sets the container to expose the following UDP ports
ports: the UDP ports the container is exposing
func (*Docker) ServicePortIndex ¶
ServicePortIndex finds the service port index of the exposed port
port: the port you are looking for
func (*Docker) SetForcePullImage ¶ added in v0.1.0
SetForcePullImage sets whether the docker image should always be force pulled before starting an instance
forcePull: true / false
func (*Docker) SetPrivileged ¶ added in v0.1.0
SetPrivileged sets whether the docker image should be started with privilege turned on
priv: true / false
type Event ¶
Event is the definition for a event in marathon
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"` }
EventAPIRequest describes an 'api_post_event' event.
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"` }
EventAddHealthCheck describes an 'add_health_check_event' event.
type EventAppTerminated ¶
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 ¶
type EventDeploymentFailed struct { ID string `json:"id"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventDeploymentFailed describes a 'deployment_failed' event.
type EventDeploymentInfo ¶
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 ¶
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 ¶
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 ¶
type EventDeploymentSuccess struct { ID string `json:"id"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventDeploymentSuccess describes a 'deployment_success' event.
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"` }
EventFailedHealthCheck describes a 'failed_health_check_event' event.
type EventFrameworkMessage ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type EventStreamAttached struct { RemoteAddress string `json:"remoteAddress"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventStreamAttached describes an 'event_stream_attached' event.
type EventStreamDetached ¶
type EventStreamDetached struct { RemoteAddress string `json:"remoteAddress"` EventType string `json:"eventType"` Timestamp string `json:"timestamp"` }
EventStreamDetached describes an 'event_stream_detached' event.
type EventSubscription ¶
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 ¶
type EventType struct {
EventType string `json:"eventType"`
}
EventType is a wrapper for a marathon event
type EventUnsubscription ¶
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 ¶
type EventsChannel chan *Event
EventsChannel is a channel to receive events upon
type EventsChannelContext ¶ added in v0.3.0
type EventsChannelContext struct {
// contains filtered or unexported fields
}
EventsChannelContext holds contextual data for an EventsChannel.
type EventsTransport ¶
type EventsTransport int
EventsTransport describes which transport should be used to deliver Marathon events
const ( // EventsTransportCallback activates callback events transport EventsTransportCallback EventsTransport = 1 << iota // EventsTransportSSE activates stream events transport EventsTransportSSE )
type ExternalVolume ¶ added in v0.4.0
type ExternalVolume struct { Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Options *map[string]string `json:"options,omitempty"` }
ExternalVolume is an external volume definition
func (*ExternalVolume) AddOption ¶ added in v0.4.0
func (ev *ExternalVolume) AddOption(name, value string) *ExternalVolume
AddOption adds an option to an ExternalVolume
name: the name of the option value: value for the option
func (*ExternalVolume) EmptyOptions ¶ added in v0.4.0
func (ev *ExternalVolume) EmptyOptions() *ExternalVolume
EmptyOptions explicitly empties the options
type Fetch ¶ added in v0.1.0
type Fetch struct { URI string `json:"uri"` Executable bool `json:"executable"` Extract bool `json:"extract"` Cache bool `json:"cache"` }
Fetch will download URI before task starts
type GetAppOpts ¶ added in v0.1.0
type GetAppOpts struct {
Embed []string `url:"embed,omitempty"`
}
GetAppOpts contains a payload for Application method
embed: Embeds nested resources that match the supplied path. You can specify this parameter multiple times with different values
type GetGroupOpts ¶ added in v0.1.0
type GetGroupOpts struct {
Embed []string `url:"embed,omitempty"`
}
GetGroupOpts contains a payload for Group and Groups method
embed: Embeds nested resources that match the supplied path. You can specify this parameter multiple times with different values
type Group ¶
type Group struct { ID string `json:"id"` Apps []*Application `json:"apps"` Dependencies []string `json:"dependencies"` Groups []*Group `json:"groups"` }
Group is a marathon application group
func NewApplicationGroup ¶
NewApplicationGroup create a new application group
name: the name of the group
func (*Group) App ¶
func (r *Group) App(application *Application) *Group
App 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"` }
Groups is a collection of marathon application groups
type HealthCheck ¶
type HealthCheck struct { Command *Command `json:"command,omitempty"` PortIndex *int `json:"portIndex,omitempty"` Port *int `json:"port,omitempty"` Path *string `json:"path,omitempty"` MaxConsecutiveFailures *int `json:"maxConsecutiveFailures,omitempty"` Protocol string `json:"protocol,omitempty"` GracePeriodSeconds int `json:"gracePeriodSeconds,omitempty"` IntervalSeconds int `json:"intervalSeconds,omitempty"` TimeoutSeconds int `json:"timeoutSeconds,omitempty"` }
HealthCheck is the definition for an application health check
func NewDefaultHealthCheck ¶
func NewDefaultHealthCheck() *HealthCheck
NewDefaultHealthCheck creates a default application health check
func (HealthCheck) SetCommand ¶ added in v0.1.0
func (h HealthCheck) SetCommand(c Command) HealthCheck
SetCommand sets the given command on the health check.
func (HealthCheck) SetMaxConsecutiveFailures ¶ added in v0.1.0
func (h HealthCheck) SetMaxConsecutiveFailures(i int) HealthCheck
SetMaxConsecutiveFailures sets the maximum consecutive failures on the health check.
func (HealthCheck) SetPath ¶ added in v0.1.0
func (h HealthCheck) SetPath(p string) HealthCheck
SetPath sets the given path on the health check.
func (HealthCheck) SetPort ¶ added in v0.1.0
func (h HealthCheck) SetPort(i int) HealthCheck
SetPort sets the given port on the health check.
func (HealthCheck) SetPortIndex ¶ added in v0.1.0
func (h HealthCheck) SetPortIndex(i int) HealthCheck
SetPortIndex sets the given port index on the health check.
type HealthCheckResult ¶
type HealthCheckResult struct { Alive bool `json:"alive"` ConsecutiveFailures int `json:"consecutiveFailures"` FirstSuccess string `json:"firstSuccess"` LastFailure string `json:"lastFailure"` LastFailureCause string `json:"lastFailureCause"` LastSuccess string `json:"lastSuccess"` TaskID string `json:"taskId"` }
HealthCheckResult is the health check result
type IPAddressPerTask ¶ added in v0.4.0
type IPAddressPerTask struct { Groups *[]string `json:"groups,omitempty"` Labels *map[string]string `json:"labels,omitempty"` Discovery Discovery `json:"discovery,omitempty"` NetworkName string `json:"networkName,omitempty"` }
IPAddressPerTask is used by IP-per-task functionality https://mesosphere.github.io/marathon/docs/ip-per-task.html
func (*IPAddressPerTask) AddGroup ¶ added in v0.4.0
func (i *IPAddressPerTask) AddGroup(group string) *IPAddressPerTask
AddGroup adds a group to an IPAddressPerTask
group: The group name
func (*IPAddressPerTask) AddLabel ¶ added in v0.4.0
func (i *IPAddressPerTask) AddLabel(name, value string) *IPAddressPerTask
AddLabel adds a label to an IPAddressPerTask
name: The label name value: The label value
func (*IPAddressPerTask) EmptyGroups ¶ added in v0.4.0
func (i *IPAddressPerTask) EmptyGroups() *IPAddressPerTask
EmptyGroups explicitly empties groups -- use this if you need to empty groups of an application that already has IP per task with groups defined
func (*IPAddressPerTask) EmptyLabels ¶ added in v0.4.0
func (i *IPAddressPerTask) EmptyLabels() *IPAddressPerTask
EmptyLabels explicitly empties labels -- use this if you need to empty labels of an application that already has IP per task with labels defined
func (*IPAddressPerTask) SetDiscovery ¶ added in v0.4.0
func (i *IPAddressPerTask) SetDiscovery(discovery Discovery) *IPAddressPerTask
SetDiscovery define the discovery to an IPAddressPerTask
discovery: The discovery struct
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"` }
Info is the detailed stats returned from marathon info
type InvalidEndpointError ¶ added in v0.5.0
type InvalidEndpointError struct {
// contains filtered or unexported fields
}
InvalidEndpointError indicates a endpoint error in the marathon urls
func (*InvalidEndpointError) Error ¶ added in v0.5.0
func (e *InvalidEndpointError) Error() string
Error returns the string message
type Item ¶ added in v0.1.0
type Item struct { Count int `json:"count"` Delay Delay `json:"delay"` Application Application `json:"app"` }
Item is the definition of element in the queue
type KillApplicationTasksOpts ¶
type KillApplicationTasksOpts struct { Host string `url:"host,omitempty"` Scale bool `url:"scale,omitempty"` Force bool `url:"force,omitempty"` }
KillApplicationTasksOpts contains a payload for KillApplicationTasks method
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
type KillTaskOpts ¶
KillTaskOpts contains a payload for task killing methods
scale: Scale the app down
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"` }
LastTaskFailure provides details on the last error experienced by an application
type Marathon ¶
type Marathon interface { // 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) (*Application, error) // delete an application DeleteApplication(name string, force bool) (*DeploymentID, error) // update an application in marathon UpdateApplication(application *Application, force bool) (*DeploymentID, 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 an application by name Application(name string) (*Application, error) // get an application by options ApplicationBy(name string, opts *GetAppOpts) (*Application, error) // get an application by name and version ApplicationByVersion(name, version 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(opts *AllTasksOpts) (*Tasks, error) // get the endpoints for a service on a application TaskEndpoints(name string, port int, healthCheck bool) ([]string, error) // kill all the tasks for any application KillApplicationTasks(applicationID string, opts *KillApplicationTasksOpts) (*Tasks, error) // kill a single task KillTask(taskID string, opts *KillTaskOpts) (*Task, error) // kill the given array of tasks KillTasks(taskIDs []string, opts *KillTaskOpts) error // list all the groups in the system Groups() (*Groups, error) // retrieve a specific group from marathon Group(name string) (*Group, error) // list all groups in marathon by options GroupsBy(opts *GetGroupOpts) (*Groups, error) // retrieve a specific group from marathon by options GroupBy(name string, opts *GetGroupOpts) (*Group, error) // create a group deployment CreateGroup(group *Group) error // delete a group DeleteGroup(name string, force bool) (*DeploymentID, error) // update a groups UpdateGroup(id string, group *Group, force bool) (*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(id string, timeout time.Duration) error // a list of current subscriptions Subscriptions() (*Subscriptions, error) // add a events listener AddEventsListener(filter int) (EventsChannel, error) // remove a events listener RemoveEventsListener(channel EventsChannel) // Subscribe a callback URL Subscribe(string) error // Unsubscribe a callback URL Unsubscribe(string) error // --- QUEUE --- // get marathon launch queue Queue() (*Queue, error) // resets task launch delay of the specific application DeleteQueueDelay(appID string) 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) }
Marathon is the interface to the marathon API
type Parameters ¶
Parameters is the parameters to pass to the docker client when creating the container
type Port ¶ added in v0.4.0
type Port struct { Number int `json:"number,omitempty"` Name string `json:"name,omitempty"` Protocol string `json:"protocol,omitempty"` }
Port provides info about ports used by IP-per-task
type PortDefinition ¶ added in v0.2.0
type PortDefinition struct { Port *int `json:"port,omitempty"` Protocol string `json:"protocol,omitempty"` Name string `json:"name,omitempty"` Labels *map[string]string `json:"labels,omitempty"` }
PortDefinition is a definition of a port that should be considered part of a resource. Port definitions are necessary when you are using HOST networking and no port mappings are specified.
func (PortDefinition) AddLabel ¶ added in v0.2.0
func (p PortDefinition) AddLabel(name, value string) PortDefinition
AddLabel adds a label to the PortDefinition
name: the name of the label value: value for this label
func (*PortDefinition) EmptyLabels ¶ added in v0.2.0
func (p *PortDefinition) EmptyLabels() *PortDefinition
EmptyLabels explicitly empties the labels -- use this if you need to empty the labels of a PortDefinition that already has labels set (setting labels to nill will keep the current value)
func (PortDefinition) SetPort ¶ added in v0.2.0
func (p PortDefinition) SetPort(port int) PortDefinition
SetPort sets the given port for the PortDefinition
type PortMapping ¶
type PortMapping struct { ContainerPort int `json:"containerPort,omitempty"` HostPort int `json:"hostPort"` Labels *map[string]string `json:"labels,omitempty"` Name string `json:"name,omitempty"` ServicePort int `json:"servicePort,omitempty"` Protocol string `json:"protocol,omitempty"` }
PortMapping is the portmapping structure between container and mesos
func (*PortMapping) AddLabel ¶ added in v0.2.0
func (p *PortMapping) AddLabel(name, value string) *PortMapping
AddLabel adds a label to a PortMapping
name: the name of the label value: value for this label
func (*PortMapping) EmptyLabels ¶ added in v0.2.0
func (p *PortMapping) EmptyLabels() *PortMapping
EmptyLabels explicitly empties the labels -- use this if you need to empty the labels of a port mapping that already has labels set (setting labels to nil will keep the current value)
type Queue ¶ added in v0.1.0
type Queue struct {
Items []Item `json:"queue"`
}
Queue is the definition of marathon queue
type StepActions ¶ added in v0.1.0
StepActions is a series of deployment steps
type Subscriptions ¶
type Subscriptions struct {
CallbackURLs []string `json:"callbackUrls"`
}
Subscriptions is a collection to urls that marathon is implementing a callback on
type Task ¶
type Task struct { ID string `json:"id"` AppID string `json:"appId"` Host string `json:"host"` HealthCheckResults []*HealthCheckResult `json:"healthCheckResults"` Ports []int `json:"ports"` ServicePorts []int `json:"servicePorts"` SlaveID string `json:"slaveId"` StagedAt string `json:"stagedAt"` StartedAt string `json:"startedAt"` IPAddresses []*IPAddress `json:"ipAddresses"` Version string `json:"version"` }
Task is the definition for a marathon task
func (*Task) HasHealthCheckResults ¶
HasHealthCheckResults checks if the task has any health checks
type Tasks ¶
type Tasks struct {
Tasks []Task `json:"tasks"`
}
Tasks is a collection of marathon tasks
type UpdateGroupOpts ¶ added in v0.1.0
type UpdateGroupOpts struct {
Force bool `url:"force,omitempty"`
}
UpdateGroupOpts contains a payload for UpdateGroup method
force: overrides a currently running deployment.
type UpgradeStrategy ¶
type UpgradeStrategy struct { MinimumHealthCapacity float64 `json:"minimumHealthCapacity"` MaximumOverCapacity float64 `json:"maximumOverCapacity"` }
UpgradeStrategy is upgrade strategy applied to a application
type VersionInfo ¶
type VersionInfo struct { LastScalingAt string `json:"lastScalingAt,omitempty"` LastConfigChangeAt string `json:"lastConfigChangeAt,omitempty"` }
VersionInfo is the application versioning details from marathon
type Volume ¶
type Volume struct { ContainerPath string `json:"containerPath,omitempty"` HostPath string `json:"hostPath,omitempty"` External *ExternalVolume `json:"external,omitempty"` Mode string `json:"mode,omitempty"` }
Volume is the docker volume details associated to the container
func (*Volume) EmptyExternalVolume ¶ added in v0.4.0
EmptyExternalVolume emptys the external volume definition
func (*Volume) SetExternalVolume ¶ added in v0.4.0
func (v *Volume) SetExternalVolume(name, provider string) *ExternalVolume
SetExternalVolume define external elements for a volume
name: the name of the volume provider: the provider of the volume (e.g. dvdi)