nomad

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Deployment
	ReadDeployment(ID string) (Deployment, error)

	// Evaluation
	ReadEvaluation(ID string) (Evaluation, error)

	// Job
	ParseJob(hcl string) (string, string, error)
	UpdateJob(name string, data string) (UpdateJobResponse, error)
	GetLatestDeployment(name string) (Deployment, error)
	StopJob(ID string, purge bool) error
	ReadJob(ID string) (ReadJobResponse, error)
}

Client interface.

type DefaultClient

type DefaultClient struct {
	Address string
}

DefaultClient is the default nomad client.

func (*DefaultClient) GetLatestDeployment

func (c *DefaultClient) GetLatestDeployment(name string) (Deployment, error)

GetLatestDeployment returns the most recent deployment for a job.

func (*DefaultClient) ParseJob

func (c *DefaultClient) ParseJob(hcl string) (string, string, error)

ParseJob takes a hcl job file and converts it to json.

func (*DefaultClient) ReadDeployment

func (c *DefaultClient) ReadDeployment(ID string) (Deployment, error)

ReadDeployment returns the data for a given deployment id.

func (*DefaultClient) ReadEvaluation

func (c *DefaultClient) ReadEvaluation(ID string) (Evaluation, error)

ReadEvaluation reads the requested evaluation.

func (*DefaultClient) ReadJob

func (c *DefaultClient) ReadJob(ID string) (ReadJobResponse, error)

ReadJob reads a job by id.

func (*DefaultClient) StopJob

func (c *DefaultClient) StopJob(ID string, purge bool) error

StopJob stops a given job.

func (*DefaultClient) UpdateJob

func (c *DefaultClient) UpdateJob(name string, data string) (UpdateJobResponse, error)

UpdateJob registers the given job with nomad.

type Deployment

type Deployment struct {
	ID                string
	JobID             string
	Status            string
	StatusDescription string
	CreateIndex       int
	ModifyIndex       int
	JobCreateIndex    int
	JobModifyIndex    int
	JobVersion        int
	TaskGroups        map[string]DeploymentTaskGroup
}

Deployment status.

type DeploymentTaskGroup

type DeploymentTaskGroup struct {
	Promoted        bool
	DesiredCanaries int
	DesiredTotal    int
	PlacedAllocs    int
	HealthyAllocs   int
	UnhealthyAllocs int
}

DeploymentTaskGroup is the task group for the deployment

type Evaluation

type Evaluation struct {
	ID                string
	Type              string
	TriggeredBy       string
	JobID             string
	Status            string
	StatusDescription string
}

Evaluation details.

type Job

type Job map[string]interface{}

Job is a job.

type Periodic

type Periodic struct {
	Enabled         bool
	ProhibitOverlap bool
	Spec            string
	SpecType        string
	TimeZone        string
}

Periodic is the configuration for a periodic job.

type ReadJobResponse

type ReadJobResponse struct {
	ID         string
	Name       string
	Periodic   Periodic
	TaskGroups []TaskGroup
	Type       string
}

ReadJobResponse is the returned job when reading a job.

type TaskGroup

type TaskGroup struct {
	Name  string
	Count int
}

TaskGroup is a task group within a job.

type UpdateJobResponse

type UpdateJobResponse struct {
	EvalID          string
	EvalCreateIndex int
	JobModifyIndex  int
}

UpdateJobResponse contains the state of the job that was created/updated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL