Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - type Agent
 - func (a *Agent) Datacenter() (string, error)
 - func (a *Agent) ForceLeave(node string) error
 - func (a *Agent) Join(addrs ...string) (int, error)
 - func (a *Agent) Members() ([]*AgentMember, error)
 - func (a *Agent) NodeName() (string, error)
 - func (a *Agent) Region() (string, error)
 - func (a *Agent) Self() (map[string]map[string]interface{}, error)
 - func (a *Agent) Servers() ([]string, error)
 - func (a *Agent) SetServers(addrs []string) error
 
- type AgentMember
 - type AgentMembersNameSort
 - type AllocFS
 - func (a *AllocFS) Cat(alloc *Allocation, path string, q *QueryOptions) (io.Reader, *QueryMeta, error)
 - func (a *AllocFS) List(alloc *Allocation, path string, q *QueryOptions) ([]*AllocFileInfo, *QueryMeta, error)
 - func (a *AllocFS) ReadAt(alloc *Allocation, path string, offset int64, limit int64, q *QueryOptions) (io.Reader, *QueryMeta, error)
 - func (a *AllocFS) Stat(alloc *Allocation, path string, q *QueryOptions) (*AllocFileInfo, *QueryMeta, error)
 
- type AllocFileInfo
 - type AllocIndexSort
 - type AllocResourceUsage
 - type Allocation
 - type AllocationListStub
 - type AllocationMetric
 - type AllocationSort
 - type Allocations
 - func (a *Allocations) Info(allocID string, q *QueryOptions) (*Allocation, *QueryMeta, error)
 - func (a *Allocations) List(q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
 - func (a *Allocations) PrefixList(prefix string) ([]*AllocationListStub, *QueryMeta, error)
 - func (a *Allocations) Stats(alloc *Allocation, q *QueryOptions) (*AllocResourceUsage, error)
 
- type Client
 - func (c *Client) Agent() *Agent
 - func (c *Client) AllocFS() *AllocFS
 - func (c *Client) Allocations() *Allocations
 - func (c *Client) Evaluations() *Evaluations
 - func (c *Client) Jobs() *Jobs
 - func (c *Client) Nodes() *Nodes
 - func (c *Client) Raw() *Raw
 - func (c *Client) Regions() *Regions
 - func (c *Client) SetRegion(region string)
 - func (c *Client) Status() *Status
 - func (c *Client) System() *System
 
- type Config
 - type Constraint
 - type CpuStats
 - type DesiredUpdates
 - type EvalIndexSort
 - type Evaluation
 - type Evaluations
 - func (e *Evaluations) Allocations(evalID string, q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
 - func (e *Evaluations) Info(evalID string, q *QueryOptions) (*Evaluation, *QueryMeta, error)
 - func (e *Evaluations) List(q *QueryOptions) ([]*Evaluation, *QueryMeta, error)
 - func (e *Evaluations) PrefixList(prefix string) ([]*Evaluation, *QueryMeta, error)
 
- type FieldDiff
 - type HostCPUStats
 - type HostDiskStats
 - type HostMemoryStats
 - type HostStats
 - type Job
 - type JobDiff
 - type JobIDSort
 - type JobListStub
 - type JobPlanRequest
 - type JobPlanResponse
 - type Jobs
 - func (j *Jobs) Allocations(jobID string, q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
 - func (j *Jobs) Deregister(jobID string, q *WriteOptions) (string, *WriteMeta, error)
 - func (j *Jobs) EnforceRegister(job *Job, modifyIndex uint64, q *WriteOptions) (string, *WriteMeta, error)
 - func (j *Jobs) Evaluations(jobID string, q *QueryOptions) ([]*Evaluation, *QueryMeta, error)
 - func (j *Jobs) ForceEvaluate(jobID string, q *WriteOptions) (string, *WriteMeta, error)
 - func (j *Jobs) Info(jobID string, q *QueryOptions) (*Job, *QueryMeta, error)
 - func (j *Jobs) List(q *QueryOptions) ([]*JobListStub, *QueryMeta, error)
 - func (j *Jobs) PeriodicForce(jobID string, q *WriteOptions) (string, *WriteMeta, error)
 - func (j *Jobs) Plan(job *Job, diff bool, q *WriteOptions) (*JobPlanResponse, *WriteMeta, error)
 - func (j *Jobs) PrefixList(prefix string) ([]*JobListStub, *QueryMeta, error)
 - func (j *Jobs) Register(job *Job, q *WriteOptions) (string, *WriteMeta, error)
 
- type LogConfig
 - type MemoryStats
 - type NetworkResource
 - type Node
 - type NodeIndexSort
 - type NodeListStub
 - type Nodes
 - func (n *Nodes) Allocations(nodeID string, q *QueryOptions) ([]*Allocation, *QueryMeta, error)
 - func (n *Nodes) ForceEvaluate(nodeID string, q *WriteOptions) (string, *WriteMeta, error)
 - func (n *Nodes) Info(nodeID string, q *QueryOptions) (*Node, *QueryMeta, error)
 - func (n *Nodes) List(q *QueryOptions) ([]*NodeListStub, *QueryMeta, error)
 - func (n *Nodes) PrefixList(prefix string) ([]*NodeListStub, *QueryMeta, error)
 - func (n *Nodes) Stats(nodeID string, q *QueryOptions) (*HostStats, error)
 - func (n *Nodes) ToggleDrain(nodeID string, drain bool, q *WriteOptions) (*WriteMeta, error)
 
- type ObjectDiff
 - type PeriodicConfig
 - type PlanAnnotations
 - type Port
 - type QueryMeta
 - type QueryOptions
 - type Raw
 - type Regions
 - type RegisterJobRequest
 - type ResourceUsage
 - type Resources
 - type RestartPolicy
 - type Service
 - type ServiceCheck
 - type Status
 - type System
 - type Task
 - type TaskArtifact
 - type TaskDiff
 - type TaskEvent
 - type TaskGroup
 - type TaskGroupDiff
 - type TaskResourceUsage
 - type TaskState
 - type UpdateStrategy
 - type WriteMeta
 - type WriteOptions
 
Constants ¶
const ( // JobTypeService indicates a long-running processes JobTypeService = "service" // JobTypeBatch indicates a short-lived process JobTypeBatch = "batch" )
const ( TaskDriverFailure = "Driver Failure" TaskReceived = "Received" TaskFailedValidation = "Failed Validation" TaskStarted = "Started" TaskTerminated = "Terminated" TaskKilled = "Killed" TaskRestarting = "Restarting" TaskNotRestarting = "Not Restarting" TaskDownloadingArtifacts = "Downloading Artifacts" TaskArtifactDownloadFailed = "Failed Artifact Download" )
const ( // RegisterEnforceIndexErrPrefix is the prefix to use in errors caused by // enforcing the job modify index during registers. RegisterEnforceIndexErrPrefix = "Enforcing job modify index" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
	// contains filtered or unexported fields
}
    Agent encapsulates an API client which talks to Nomad's agent endpoints for a specific node.
func (*Agent) Datacenter ¶
Datacenter is used to return the name of the datacenter which the agent is a member of.
func (*Agent) ForceLeave ¶
ForceLeave is used to eject an existing node from the cluster.
func (*Agent) Join ¶
Join is used to instruct a server node to join another server via the gossip protocol. Multiple addresses may be specified. We attempt to join all of the hosts in the list. Returns the number of nodes successfully joined and any error. If one or more nodes have a successful result, no error is returned.
func (*Agent) Members ¶
func (a *Agent) Members() ([]*AgentMember, error)
Members is used to query all of the known server members
func (*Agent) Self ¶
Self is used to query the /v1/agent/self endpoint and returns information specific to the running agent.
func (*Agent) SetServers ¶
SetServers is used to update the list of servers on a client node.
type AgentMember ¶
type AgentMember struct {
	Name        string
	Addr        string
	Port        uint16
	Tags        map[string]string
	Status      string
	ProtocolMin uint8
	ProtocolMax uint8
	ProtocolCur uint8
	DelegateMin uint8
	DelegateMax uint8
	DelegateCur uint8
}
    AgentMember represents a cluster member known to the agent
type AgentMembersNameSort ¶ added in v0.2.0
type AgentMembersNameSort []*AgentMember
AgentMembersNameSort implements sort.Interface for []*AgentMembersNameSort based on the Name, DC and Region
func (AgentMembersNameSort) Len ¶ added in v0.2.0
func (a AgentMembersNameSort) Len() int
func (AgentMembersNameSort) Less ¶ added in v0.2.0
func (a AgentMembersNameSort) Less(i, j int) bool
func (AgentMembersNameSort) Swap ¶ added in v0.2.0
func (a AgentMembersNameSort) Swap(i, j int)
type AllocFS ¶ added in v0.3.0
type AllocFS struct {
	// contains filtered or unexported fields
}
    AllocFS is used to introspect an allocation directory on a Nomad client
func (*AllocFS) Cat ¶ added in v0.3.2
func (a *AllocFS) Cat(alloc *Allocation, path string, q *QueryOptions) (io.Reader, *QueryMeta, error)
Cat is used to read contents of a file at the given path in an allocation directory
func (*AllocFS) List ¶ added in v0.3.0
func (a *AllocFS) List(alloc *Allocation, path string, q *QueryOptions) ([]*AllocFileInfo, *QueryMeta, error)
List is used to list the files at a given path of an allocation directory
func (*AllocFS) ReadAt ¶ added in v0.3.0
func (a *AllocFS) ReadAt(alloc *Allocation, path string, offset int64, limit int64, q *QueryOptions) (io.Reader, *QueryMeta, error)
ReadAt is used to read bytes at a given offset until limit at the given path in an allocation directory
func (*AllocFS) Stat ¶ added in v0.3.0
func (a *AllocFS) Stat(alloc *Allocation, path string, q *QueryOptions) (*AllocFileInfo, *QueryMeta, error)
Stat is used to stat a file at a given path of an allocation directory
type AllocFileInfo ¶ added in v0.3.0
AllocFileInfo holds information about a file inside the AllocDir
type AllocIndexSort ¶
type AllocIndexSort []*AllocationListStub
AllocIndexSort reverse sorts allocs by CreateIndex.
func (AllocIndexSort) Len ¶
func (a AllocIndexSort) Len() int
func (AllocIndexSort) Less ¶
func (a AllocIndexSort) Less(i, j int) bool
func (AllocIndexSort) Swap ¶
func (a AllocIndexSort) Swap(i, j int)
type AllocResourceUsage ¶ added in v0.4.0
type AllocResourceUsage struct {
	ResourceUsage *ResourceUsage
	Tasks         map[string]*TaskResourceUsage
	Timestamp     int64
}
    AllocResourceUsage holds the aggregated task resource usage of the allocation.
type Allocation ¶
type Allocation struct {
	ID                 string
	EvalID             string
	Name               string
	NodeID             string
	JobID              string
	Job                *Job
	TaskGroup          string
	Resources          *Resources
	TaskResources      map[string]*Resources
	Services           map[string]string
	Metrics            *AllocationMetric
	DesiredStatus      string
	DesiredDescription string
	ClientStatus       string
	ClientDescription  string
	TaskStates         map[string]*TaskState
	CreateIndex        uint64
	ModifyIndex        uint64
	CreateTime         int64
}
    Allocation is used for serialization of allocations.
type AllocationListStub ¶
type AllocationListStub struct {
	ID                 string
	EvalID             string
	Name               string
	NodeID             string
	JobID              string
	TaskGroup          string
	DesiredStatus      string
	DesiredDescription string
	ClientStatus       string
	ClientDescription  string
	TaskStates         map[string]*TaskState
	CreateIndex        uint64
	ModifyIndex        uint64
	CreateTime         int64
}
    AllocationListStub is used to return a subset of an allocation during list operations.
type AllocationMetric ¶
type AllocationMetric struct {
	NodesEvaluated     int
	NodesFiltered      int
	NodesAvailable     map[string]int
	ClassFiltered      map[string]int
	ConstraintFiltered map[string]int
	NodesExhausted     int
	ClassExhausted     map[string]int
	DimensionExhausted map[string]int
	Scores             map[string]float64
	AllocationTime     time.Duration
	CoalescedFailures  int
}
    AllocationMetric is used to deserialize allocation metrics.
type AllocationSort ¶ added in v0.2.0
type AllocationSort []*Allocation
AllocationSort reverse sorts allocs by CreateIndex.
func (AllocationSort) Len ¶ added in v0.2.0
func (a AllocationSort) Len() int
func (AllocationSort) Less ¶ added in v0.2.0
func (a AllocationSort) Less(i, j int) bool
func (AllocationSort) Swap ¶ added in v0.2.0
func (a AllocationSort) Swap(i, j int)
type Allocations ¶
type Allocations struct {
	// contains filtered or unexported fields
}
    Allocations is used to query the alloc-related endpoints.
func (*Allocations) Info ¶
func (a *Allocations) Info(allocID string, q *QueryOptions) (*Allocation, *QueryMeta, error)
Info is used to retrieve a single allocation.
func (*Allocations) List ¶
func (a *Allocations) List(q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
List returns a list of all of the allocations.
func (*Allocations) PrefixList ¶ added in v0.3.0
func (a *Allocations) PrefixList(prefix string) ([]*AllocationListStub, *QueryMeta, error)
func (*Allocations) Stats ¶ added in v0.4.0
func (a *Allocations) Stats(alloc *Allocation, q *QueryOptions) (*AllocResourceUsage, error)
type Client ¶
type Client struct {
	// contains filtered or unexported fields
}
    Client provides a client to the Nomad API
func (*Client) Agent ¶
Agent returns a new agent which can be used to query the agent-specific endpoints.
func (*Client) Allocations ¶
func (c *Client) Allocations() *Allocations
Allocations returns a handle on the allocs endpoints.
func (*Client) Evaluations ¶
func (c *Client) Evaluations() *Evaluations
Evaluations returns a new handle on the evaluations.
type Config ¶
type Config struct {
	// Address is the address of the Nomad agent
	Address string
	// Region to use. If not provided, the default agent region is used.
	Region string
	// HttpClient is the client to use. Default will be
	// used if not provided.
	HttpClient *http.Client
	// WaitTime limits how long a Watch will block. If not provided,
	// the agent default values will be used.
	WaitTime time.Duration
}
    Config is used to configure the creation of a client
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default configuration for the client
type Constraint ¶
Constraint is used to serialize a job placement constraint.
func NewConstraint ¶ added in v0.2.0
func NewConstraint(left, operand, right string) *Constraint
NewConstraint generates a new job placement constraint.
type CpuStats ¶ added in v0.4.0
type CpuStats struct {
	SystemMode       float64
	UserMode         float64
	TotalTicks       float64
	ThrottledPeriods uint64
	ThrottledTime    uint64
	Percent          float64
	Measured         []string
}
    CpuStats holds cpu usage related stats
type DesiredUpdates ¶ added in v0.4.0
type EvalIndexSort ¶
type EvalIndexSort []*Evaluation
EvalIndexSort is a wrapper to sort evaluations by CreateIndex. We reverse the test so that we get the highest index first.
func (EvalIndexSort) Len ¶
func (e EvalIndexSort) Len() int
func (EvalIndexSort) Less ¶
func (e EvalIndexSort) Less(i, j int) bool
func (EvalIndexSort) Swap ¶
func (e EvalIndexSort) Swap(i, j int)
type Evaluation ¶
type Evaluation struct {
	ID                string
	Priority          int
	Type              string
	TriggeredBy       string
	JobID             string
	JobModifyIndex    uint64
	NodeID            string
	NodeModifyIndex   uint64
	Status            string
	StatusDescription string
	Wait              time.Duration
	NextEval          string
	PreviousEval      string
	BlockedEval       string
	FailedTGAllocs    map[string]*AllocationMetric
	CreateIndex       uint64
	ModifyIndex       uint64
}
    Evaluation is used to serialize an evaluation.
type Evaluations ¶
type Evaluations struct {
	// contains filtered or unexported fields
}
    Evaluations is used to query the evaluation endpoints.
func (*Evaluations) Allocations ¶
func (e *Evaluations) Allocations(evalID string, q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
Allocations is used to retrieve a set of allocations given an evaluation ID.
func (*Evaluations) Info ¶
func (e *Evaluations) Info(evalID string, q *QueryOptions) (*Evaluation, *QueryMeta, error)
Info is used to query a single evaluation by its ID.
func (*Evaluations) List ¶
func (e *Evaluations) List(q *QueryOptions) ([]*Evaluation, *QueryMeta, error)
List is used to dump all of the evaluations.
func (*Evaluations) PrefixList ¶ added in v0.3.0
func (e *Evaluations) PrefixList(prefix string) ([]*Evaluation, *QueryMeta, error)
type HostCPUStats ¶ added in v0.4.0
type HostDiskStats ¶ added in v0.4.0
type HostMemoryStats ¶ added in v0.4.0
type HostStats ¶ added in v0.4.0
type HostStats struct {
	Memory           *HostMemoryStats
	CPU              []*HostCPUStats
	DiskStats        []*HostDiskStats
	Uptime           uint64
	CPUTicksConsumed float64
}
    HostStats represents resource usage stats of the host running a Nomad client
type Job ¶
type Job struct {
	Region            string
	ID                string
	Name              string
	Type              string
	Priority          int
	AllAtOnce         bool
	Datacenters       []string
	Constraints       []*Constraint
	TaskGroups        []*TaskGroup
	Update            *UpdateStrategy
	Periodic          *PeriodicConfig
	Meta              map[string]string
	Status            string
	StatusDescription string
	CreateIndex       uint64
	ModifyIndex       uint64
	JobModifyIndex    uint64
}
    Job is used to serialize a job.
func NewBatchJob ¶
NewBatchJob creates and returns a new batch-style job for short-lived processes using the provided name and ID along with the relative job priority.
func NewServiceJob ¶
NewServiceJob creates and returns a new service-style job for long-lived processes using the provided name, ID, and relative job priority.
func (*Job) AddDatacenter ¶
AddDatacenter is used to add a datacenter to a job.
func (*Job) AddPeriodicConfig ¶ added in v0.3.0
func (j *Job) AddPeriodicConfig(cfg *PeriodicConfig) *Job
AddPeriodicConfig adds a periodic config to an existing job.
func (*Job) AddTaskGroup ¶
AddTaskGroup adds a task group to an existing job.
func (*Job) Constrain ¶
func (j *Job) Constrain(c *Constraint) *Job
Constrain is used to add a constraint to a job.
type JobDiff ¶ added in v0.4.0
type JobDiff struct {
	Type       string
	ID         string
	Fields     []*FieldDiff
	Objects    []*ObjectDiff
	TaskGroups []*TaskGroupDiff
}
    type JobListStub ¶
type JobListStub struct {
	ID                string
	ParentID          string
	Name              string
	Type              string
	Priority          int
	Status            string
	StatusDescription string
	CreateIndex       uint64
	ModifyIndex       uint64
	JobModifyIndex    uint64
}
    JobListStub is used to return a subset of information about jobs during list operations.
type JobPlanRequest ¶ added in v0.4.0
type JobPlanResponse ¶ added in v0.4.0
type JobPlanResponse struct {
	JobModifyIndex     uint64
	CreatedEvals       []*Evaluation
	Diff               *JobDiff
	Annotations        *PlanAnnotations
	FailedTGAllocs     map[string]*AllocationMetric
	NextPeriodicLaunch time.Time
}
    type Jobs ¶
type Jobs struct {
	// contains filtered or unexported fields
}
    Jobs is used to access the job-specific endpoints.
func (*Jobs) Allocations ¶
func (j *Jobs) Allocations(jobID string, q *QueryOptions) ([]*AllocationListStub, *QueryMeta, error)
Allocations is used to return the allocs for a given job ID.
func (*Jobs) Deregister ¶
Deregister is used to remove an existing job.
func (*Jobs) EnforceRegister ¶ added in v0.4.0
func (j *Jobs) EnforceRegister(job *Job, modifyIndex uint64, q *WriteOptions) (string, *WriteMeta, error)
EnforceRegister is used to register a job enforcing its job modify index.
func (*Jobs) Evaluations ¶
func (j *Jobs) Evaluations(jobID string, q *QueryOptions) ([]*Evaluation, *QueryMeta, error)
Evaluations is used to query the evaluations associated with the given job ID.
func (*Jobs) ForceEvaluate ¶
ForceEvaluate is used to force-evaluate an existing job.
func (*Jobs) Info ¶
Info is used to retrieve information about a particular job given its unique ID.
func (*Jobs) List ¶
func (j *Jobs) List(q *QueryOptions) ([]*JobListStub, *QueryMeta, error)
List is used to list all of the existing jobs.
func (*Jobs) PeriodicForce ¶ added in v0.3.0
PeriodicForce spawns a new instance of the periodic job and returns the eval ID
func (*Jobs) Plan ¶ added in v0.4.0
func (j *Jobs) Plan(job *Job, diff bool, q *WriteOptions) (*JobPlanResponse, *WriteMeta, error)
func (*Jobs) PrefixList ¶ added in v0.3.0
func (j *Jobs) PrefixList(prefix string) ([]*JobListStub, *QueryMeta, error)
PrefixList is used to list all existing jobs that match the prefix.
type MemoryStats ¶ added in v0.4.0
type MemoryStats struct {
	RSS            uint64
	Cache          uint64
	Swap           uint64
	MaxUsage       uint64
	KernelUsage    uint64
	KernelMaxUsage uint64
	Measured       []string
}
    MemoryStats holds memory usage related stats
type NetworkResource ¶
type NetworkResource struct {
	Public        bool
	CIDR          string
	ReservedPorts []Port
	DynamicPorts  []Port
	IP            string
	MBits         int
}
    NetworkResource is used to describe required network resources of a given task.
type Node ¶
type Node struct {
	ID                string
	Datacenter        string
	Name              string
	HTTPAddr          string
	Attributes        map[string]string
	Resources         *Resources
	Reserved          *Resources
	Links             map[string]string
	Meta              map[string]string
	NodeClass         string
	Drain             bool
	Status            string
	StatusDescription string
	CreateIndex       uint64
	ModifyIndex       uint64
}
    Node is used to deserialize a node entry.
type NodeIndexSort ¶
type NodeIndexSort []*NodeListStub
NodeIndexSort reverse sorts nodes by CreateIndex
func (NodeIndexSort) Len ¶
func (n NodeIndexSort) Len() int
func (NodeIndexSort) Less ¶
func (n NodeIndexSort) Less(i, j int) bool
func (NodeIndexSort) Swap ¶
func (n NodeIndexSort) Swap(i, j int)
type NodeListStub ¶
type NodeListStub struct {
	ID                string
	Datacenter        string
	Name              string
	NodeClass         string
	Drain             bool
	Status            string
	StatusDescription string
	CreateIndex       uint64
	ModifyIndex       uint64
}
    NodeListStub is a subset of information returned during node list operations.
type Nodes ¶
type Nodes struct {
	// contains filtered or unexported fields
}
    Nodes is used to query node-related API endpoints
func (*Nodes) Allocations ¶
func (n *Nodes) Allocations(nodeID string, q *QueryOptions) ([]*Allocation, *QueryMeta, error)
Allocations is used to return the allocations associated with a node.
func (*Nodes) ForceEvaluate ¶
ForceEvaluate is used to force-evaluate an existing node.
func (*Nodes) List ¶
func (n *Nodes) List(q *QueryOptions) ([]*NodeListStub, *QueryMeta, error)
List is used to list out all of the nodes
func (*Nodes) PrefixList ¶ added in v0.3.0
func (n *Nodes) PrefixList(prefix string) ([]*NodeListStub, *QueryMeta, error)
func (*Nodes) Stats ¶ added in v0.4.0
func (n *Nodes) Stats(nodeID string, q *QueryOptions) (*HostStats, error)
func (*Nodes) ToggleDrain ¶
ToggleDrain is used to toggle drain mode on/off for a given node.
type ObjectDiff ¶ added in v0.4.0
type ObjectDiff struct {
	Type    string
	Name    string
	Fields  []*FieldDiff
	Objects []*ObjectDiff
}
    type PeriodicConfig ¶ added in v0.3.0
PeriodicConfig is for serializing periodic config for a job.
type PlanAnnotations ¶ added in v0.4.0
type PlanAnnotations struct {
	DesiredTGUpdates map[string]*DesiredUpdates
}
    type QueryMeta ¶
type QueryMeta struct {
	// LastIndex. This can be used as a WaitIndex to perform
	// a blocking query
	LastIndex uint64
	// Time of last contact from the leader for the
	// server servicing the request
	LastContact time.Duration
	// Is there a known leader
	KnownLeader bool
	// How long did the request take
	RequestTime time.Duration
}
    QueryMeta is used to return meta data about a query
type QueryOptions ¶
type QueryOptions struct {
	// Providing a datacenter overwrites the region provided
	// by the Config
	Region string
	// AllowStale allows any Nomad server (non-leader) to service
	// a read. This allows for lower latency and higher throughput
	AllowStale bool
	// WaitIndex is used to enable a blocking query. Waits
	// until the timeout or the next index is reached
	WaitIndex uint64
	// WaitTime is used to bound the duration of a wait.
	// Defaults to that of the Config, but can be overridden.
	WaitTime time.Duration
	// If set, used as prefix for resource list searches
	Prefix string
}
    QueryOptions are used to parameterize a query
type Raw ¶
type Raw struct {
	// contains filtered or unexported fields
}
    Raw can be used to do raw queries against custom endpoints
func (*Raw) Delete ¶
func (raw *Raw) Delete(endpoint string, out interface{}, q *WriteOptions) (*WriteMeta, error)
Delete is used to do a DELETE request against an endpoint and serialize/deserialized using the standard Nomad conventions.
type Regions ¶ added in v0.2.1
type Regions struct {
	// contains filtered or unexported fields
}
    Regions is used to query the regions in the cluster.
type RegisterJobRequest ¶ added in v0.3.2
RegisterJobRequest is used to serialize a job registration
type ResourceUsage ¶ added in v0.4.0
type ResourceUsage struct {
	MemoryStats *MemoryStats
	CpuStats    *CpuStats
}
    ResourceUsage holds information related to cpu and memory stats
type Resources ¶
type Resources struct {
	CPU      int
	MemoryMB int
	DiskMB   int
	IOPS     int
	Networks []*NetworkResource
}
    Resources encapsulates the required resources of a given task or task group.
type RestartPolicy ¶ added in v0.2.0
RestartPolicy defines how the Nomad client restarts tasks in a taskgroup when they fail
type Service ¶ added in v0.2.0
type Service struct {
	Id        string
	Name      string
	Tags      []string
	PortLabel string `mapstructure:"port"`
	Checks    []ServiceCheck
}
    The Service model represents a Consul service definition
type ServiceCheck ¶ added in v0.2.0
type ServiceCheck struct {
	Id       string
	Name     string
	Type     string
	Command  string
	Args     []string
	Path     string
	Protocol string
	Interval time.Duration
	Timeout  time.Duration
}
    The ServiceCheck data model represents the consul health check that Nomad registers for a Task
type Status ¶
type Status struct {
	// contains filtered or unexported fields
}
    Status is used to query the status-related endpoints.
type System ¶ added in v0.3.0
type System struct {
	// contains filtered or unexported fields
}
    Status is used to query the status-related endpoints.
func (*System) GarbageCollect ¶ added in v0.3.0
type Task ¶
type Task struct {
	Name        string
	Driver      string
	User        string
	Config      map[string]interface{}
	Constraints []*Constraint
	Env         map[string]string
	Services    []Service
	Resources   *Resources
	Meta        map[string]string
	KillTimeout time.Duration
	LogConfig   *LogConfig
	Artifacts   []*TaskArtifact
}
    Task is a single process in a task group.
func (*Task) Constrain ¶
func (t *Task) Constrain(c *Constraint) *Task
Constraint adds a new constraints to a single task.
func (*Task) SetLogConfig ¶ added in v0.3.0
SetLogConfig sets a log config to a task
type TaskArtifact ¶ added in v0.3.1
type TaskArtifact struct {
	GetterSource  string
	GetterOptions map[string]string
	RelativeDest  string
}
    TaskArtifact is used to download artifacts before running a task.
type TaskDiff ¶ added in v0.4.0
type TaskDiff struct {
	Type        string
	Name        string
	Fields      []*FieldDiff
	Objects     []*ObjectDiff
	Annotations []string
}
    type TaskEvent ¶ added in v0.2.0
type TaskEvent struct {
	Type            string
	Time            int64
	RestartReason   string
	DriverError     string
	ExitCode        int
	Signal          int
	Message         string
	KillError       string
	StartDelay      int64
	DownloadError   string
	ValidationError string
}
    TaskEvent is an event that effects the state of a task and contains meta-data appropriate to the events type.
type TaskGroup ¶
type TaskGroup struct {
	Name          string
	Count         int
	Constraints   []*Constraint
	Tasks         []*Task
	RestartPolicy *RestartPolicy
	Meta          map[string]string
}
    TaskGroup is the unit of scheduling.
func NewTaskGroup ¶
NewTaskGroup creates a new TaskGroup.
func (*TaskGroup) Constrain ¶
func (g *TaskGroup) Constrain(c *Constraint) *TaskGroup
Constrain is used to add a constraint to a task group.
type TaskGroupDiff ¶ added in v0.4.0
type TaskResourceUsage ¶ added in v0.4.0
type TaskResourceUsage struct {
	ResourceUsage *ResourceUsage
	Timestamp     int64
	Pids          map[string]*ResourceUsage
}
    TaskResourceUsage holds aggregated resource usage of all processes in a Task and the resource usage of the individual pids
type TaskState ¶ added in v0.2.0
TaskState tracks the current state of a task and events that caused state transitions.
type UpdateStrategy ¶ added in v0.2.0
UpdateStrategy is for serializing update strategy for a job.
type WriteMeta ¶
type WriteMeta struct {
	// LastIndex. This can be used as a WaitIndex to perform
	// a blocking query
	LastIndex uint64
	// How long did the request take
	RequestTime time.Duration
}
    WriteMeta is used to return meta data about a write
type WriteOptions ¶
type WriteOptions struct {
	// Providing a datacenter overwrites the region provided
	// by the Config
	Region string
}
    WriteOptions are used to parameterize a write