Documentation
¶
Index ¶
- type Address
- type Client
- func (c *Client) Agents() ([]master.Response_GetAgents_Agent, error)
- func (c *Client) Browse(agent string, path string) ([]File, error)
- func (c *Client) DeactivateAgent(agentID string) error
- func (c *Client) Debug(agent string) (map[string]string, error)
- func (c *Client) DeleteQuota(quota string) error
- func (c *Client) Download(agent string, filePath string) ([]byte, error)
- func (c *Client) DrainAgent(agentID string, gracePeriod time.Duration, markGone bool) error
- func (c *Client) Frameworks() ([]master.Response_GetFrameworks_Framework, error)
- func (c *Client) Hosts(host string) ([]Host, error)
- func (c *Client) Leader() (*Master, error)
- func (c *Client) MarkAgentGone(agentID string) error
- func (c *Client) Masters() ([]Master, error)
- func (c *Client) Quota() (*master.Response_GetQuota, error)
- func (c *Client) ReactivateAgent(agentID string) error
- func (c *Client) Roles() (*Roles, error)
- func (c *Client) State() (*State, error)
- func (c *Client) StateSummary() (*StateSummary, error)
- func (c *Client) Tasks() ([]mesos.Task, error)
- func (c *Client) TeardownFramework(frameworkID string) error
- func (c *Client) UpdateQuota(name string, cpu float64, disk float64, gpu float64, mem float64, force bool) error
- type Container
- type ContainerID
- type ContainerStatus
- type Docker
- type Domain
- type Executor
- type File
- type Framework
- type Host
- type IPAddress
- type Label
- type Master
- type NetworkInfo
- type Offer
- type Parameter
- type PortDetails
- type PortMapping
- type Ports
- type Quota
- type Resources
- type Roles
- type Slave
- type State
- type StateSummary
- type Task
- type TaskDiscovery
- type TaskIO
- type TaskIOOpts
- type TaskStatus
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
Hostname string `json:"hostname"`
IP string `json:"ip"`
Port int `json:"port"`
}
Address represents a single address. e.g. from a Slave or from a Master
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Mesos client for DC/OS.
func NewClient ¶
func NewClient(baseClient *httpclient.Client) *Client
NewClient creates a new Mesos client.
func NewClientWithContext ¶
NewClientWithContext returns a client with a `baseURL` to communicate with Mesos.
func (*Client) Agents ¶
func (c *Client) Agents() ([]master.Response_GetAgents_Agent, error)
Agents returns the agents of the mesos cluster.
func (*Client) DeactivateAgent ¶
DeactivateAgent deactivates an agent.
func (*Client) DeleteQuota ¶
DeleteQuota deletes a quota.
func (*Client) Download ¶
Download returns bytes read from a file in the sandbox of a task at the location of filePath.
func (*Client) DrainAgent ¶
DrainAgent drains an agent.
func (*Client) Frameworks ¶
func (c *Client) Frameworks() ([]master.Response_GetFrameworks_Framework, error)
Frameworks returns the frameworks of the connected cluster.
func (*Client) MarkAgentGone ¶
MarkAgentGone marks an agent as gone.
func (*Client) Quota ¶
func (c *Client) Quota() (*master.Response_GetQuota, error)
Quota returns a quota.
func (*Client) ReactivateAgent ¶
ReactivateAgent reactivates an agent.
func (*Client) StateSummary ¶
func (c *Client) StateSummary() (*StateSummary, error)
StateSummary returns a StateSummary of the Mesos master.
func (*Client) TeardownFramework ¶
TeardownFramework teardowns a framework.
type ContainerID ¶
type ContainerID struct {
Value string `json:"value"`
Parent *ContainerID `json:"parent"`
}
ContainerID represents the ID of a container
type ContainerStatus ¶
type ContainerStatus struct {
ContainerID ContainerID `json:"container_id"`
NetworkInfos []NetworkInfo `json:"network_infos"`
}
ContainerStatus represents the status of a single container inside a task
type Docker ¶
type Docker struct {
Image string `json:"image"`
Network string `json:"network"`
PortMappings []PortMapping `json:"port_mappings"`
Privileged bool `json:"privileged"`
Parameters []Parameter `json:"parameters"`
ForcePullImage bool `json:"force_pull_image"`
}
Docker is one type of Container
type Domain ¶
type Domain struct {
FaultDomain struct {
Region struct {
Name string `json:"name"`
} `json:"region"`
Zone struct {
Name string `json:"name"`
} `json:"zone"`
} `json:"fault_domain"`
}
Domain holds information about a nodes region and zone.
type Executor ¶
type Executor struct {
CompletedTasks []Task `json:"completed_tasks"`
Container string `json:"container"`
Directory string `json:"directory"`
ID string `json:"id"`
Name string `json:"name"`
Resources Resources `json:"resources"`
Source string `json:"source"`
QueuedTasks []Task `json:"queued_tasks"`
Tasks []Task `json:"tasks"`
}
Executor represents a single executor of a framework
type File ¶
type File struct {
GID string `json:"gid"`
Mode string `json:"mode"`
MTime float64 `json:"mtime"`
NLink float64 `json:"nlink"`
Path string `json:"path"`
Size float64 `json:"size"`
UID string `json:"uid"`
}
File represents an element returned when hitting the '/browse' endpoint.
type Framework ¶
type Framework struct {
Active bool `json:"active"`
Capabilities []string `json:"capabilities"`
Checkpoint bool `json:"checkpoint"`
CompletedTasks []Task `json:"completed_tasks"`
Executors []Executor `json:"executors"`
CompletedExecutors []Executor `json:"completed_executors"`
FailoverTimeout float64 `json:"failover_timeout"`
Hostname string `json:"hostname"`
ID string `json:"id"`
Name string `json:"name"`
PID string `json:"pid"`
OfferedResources Resources `json:"offered_resources"`
Offers []Offer `json:"offers"`
RegisteredTime float64 `json:"registered_time"`
ReregisteredTime float64 `json:"reregistered_time"`
Resources Resources `json:"resources"`
Role string `json:"role"`
Tasks []Task `json:"tasks"`
UnregisteredTime float64 `json:"unregistered_time"`
UsedResources Resources `json:"used_resources"`
User string `json:"user"`
WebuiURL string `json:"webui_url"`
Labels []Label `json:"label"`
}
Framework represent a single framework of a mesos node.
type IPAddress ¶
type IPAddress struct {
IPAddress string `json:"ip_address"`
}
IPAddress represents a single IpAddress
type Master ¶
type Master struct {
Host string `json:"host"`
IP string `json:"ip"`
PublicIPs []string `json:"public_ips"`
Type string `json:"type"`
Region string `json:"region"`
Zone string `json:"zone"`
ID string `json:"id"`
PID string `json:"pid"`
Version string `json:"version"`
}
Master represents a single mesos master node.
type NetworkInfo ¶
type NetworkInfo struct {
IPAddress string `json:"ip_address"`
IPAddresses []IPAddress `json:"ip_addresses"`
}
NetworkInfo represents information about the network of a container
type Offer ¶
type Offer struct {
ID string `json:"id"`
FrameworkID string `json:"framework_id"`
SlaveID string `json:"slave_id"`
Hostname string `json:"hostname"`
URL URL `json:"url"`
Resources Resources `json:"resources"`
Attributes map[string]string `json:"attributes"`
}
Offer represents a single offer from a Mesos Slave to a Mesos master
type PortDetails ¶
PortDetails represents details about a single port
type PortMapping ¶
type PortMapping struct {
HostPort int `json:"host_port"`
ContainerPort int `json:"container_port"`
Protocol string `json:"protocol"`
}
PortMapping represents how containers ports map to host ports
type Ports ¶
type Ports struct {
Ports []PortDetails `json:"ports"`
}
Ports represents a number of PortDetails
type Quota ¶
type Quota struct {
Role string `json:"role"`
Consumed map[string]interface{} `json:"consumed,omitempty"`
Guarantee map[string]interface{} `json:"guarantee,omitempty"`
Limit map[string]interface{} `json:"limit,omitempty"`
}
Quota represents a role's quota
type Resources ¶
type Resources struct {
CPUs float64 `json:"cpus"`
Disk float64 `json:"disk"`
GPUs float64 `json:"gpus"`
Mem float64 `json:"mem"`
Ports string `json:"ports"`
}
Resources represents a resource type for a task.
type Roles ¶
type Roles struct {
Roles []struct {
Quota Quota `json:"quota"`
} `json:"roles"`
}
Roles represents a stripped down representation of mesos/roles
type Slave ¶
type Slave struct {
TaskError int `json:"TASK_ERROR"`
TaskFailed int `json:"TASK_FAILED"`
TaskFinished int `json:"TASK_FINISHED"`
TaskKilled int `json:"TASK_KILLED"`
TaskKilling int `json:"TASK_KILLING"`
TaskLost int `json:"TASK_LOST"`
TaskRunning int `json:"TASK_RUNNING"`
TaskStaging int `json:"TASK_STAGING"`
TaskStarting int `json:"TASK_STARTING"`
TaskUnreachable int `json:"TASK_UNREACHABLE"`
Active bool `json:"active"`
Attributes map[string]interface{} `json:"attributes"`
Capabilities []string `json:"capabilities"`
Domain Domain `json:"domain"`
FrameworkIDs []string `json:"framework_ids"`
Hostname string `json:"hostname"`
PublicIPs []string `json:"public_ips"`
ID string `json:"id"`
PID string `json:"pid"`
Port int `json:"port"`
Region string `json:"region"`
RegisteredTime float64 `json:"registered_time"`
Resources Resources `json:"resources"`
UsedResources Resources `json:"used_resources"`
OfferedResources Resources `json:"offered_resources"`
ReservedResources map[string]Resources `json:"reserved_resources"`
UnreservedResources Resources `json:"unreserved_resources"`
Type string `json:"type"`
Version string `json:"version"`
Zone string `json:"zone"`
Status string `json:"status"`
}
Slave represents a single mesos slave node.
type State ¶
type State struct {
Version string `json:"version"`
ID string `json:"id"`
PID string `json:"pid"`
Hostname string `json:"hostname"`
ActivatedSlaves float64 `json:"activated_slaves"`
DeactivatedSlaves float64 `json:"deactivated_slaves"`
Domain Domain `json:"domain"`
Cluster string `json:"cluster"`
Leader string `json:"leader"`
Slaves []Slave `json:"slaves"`
Frameworks []Framework `json:"frameworks"`
CompletedFrameworks []Framework `json:"completed_frameworks"`
}
State represents a state.json returned by a mesos master.
type StateSummary ¶
StateSummary summarizes the state of a mesos master.
type Task ¶
type Task struct {
ExecutorID string `json:"executor_id"`
FrameworkID string `json:"framework_id"`
ID string `json:"id"`
Labels []Label `json:"labels"`
Name string `json:"name"`
Resources Resources `json:"resources"`
SlaveID string `json:"slave_id"`
State string `json:"state"`
Statuses []TaskStatus `json:"statuses"`
Discovery TaskDiscovery `json:"discovery"`
Container Container `json:"container"`
}
Task represent a single Mesos task
type TaskDiscovery ¶
type TaskDiscovery struct {
Visibility string `json:"visibility"`
Name string `json:"name"`
Ports Ports `json:"ports"`
}
TaskDiscovery represents the discovery information of a task
type TaskIO ¶
type TaskIO struct {
// contains filtered or unexported fields
}
TaskIO is an abstraction used to stream I/O between a running Mesos task and the local terminal.
A TaskIO object can only be used for a single streaming session (through Attach or Exec), for subsequent streaming sessions one should instantiate new TaskIO objects.
func NewTaskIO ¶
func NewTaskIO(containerID mesos.ContainerID, opts TaskIOOpts) (*TaskIO, error)
NewTaskIO creates a new TaskIO.
func (*TaskIO) Attach ¶
Attach attaches the stdin/stdout/stderr of the CLI to the STDIN/STDOUT/STDERR of a running task.
As of now, we can only attach to tasks launched with a remote TTY already set up for them. If we try to attach to a task that was launched without a remote TTY attached, an error is returned.
type TaskIOOpts ¶
type TaskIOOpts struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Interactive bool
TTY bool
User string
HeartbeatInterval time.Duration
EscapeSequence []byte
Sender agentcalls.Sender
Logger *logrus.Logger
}
TaskIOOpts are options for a TaskIO.
type TaskStatus ¶
type TaskStatus struct {
State string `json:"state"`
Timestamp float64 `json:"timestamp"`
ContainerStatus ContainerStatus `json:"container_status"`
}
TaskStatus represents the status of a single task